Actually ... it's pretty silly that parse_oper.c doesn't set up the
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Nov 2007 19:40:25 +0000 (19:40 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Nov 2007 19:40:25 +0000 (19:40 +0000)
opfuncid of an OpExpr initially, considering that it has the information
at hand already.  We'll still treat opfuncid as a cache rather than a
guaranteed-valid value, but this change saves one more syscache lookup
in the normal code path.

src/backend/parser/parse_oper.c
src/include/nodes/primnodes.h

index 57a73989f0286c225315bbe351b9560c471a12ea..257c3bac6593bc5f333ebce5a5e4c9b63fd52859 100644 (file)
@@ -939,7 +939,7 @@ make_scalar_array_op(ParseState *pstate, List *opname,
        /* and build the expression node */
        result = makeNode(ScalarArrayOpExpr);
        result->opno = oprid(tup);
-       result->opfuncid = InvalidOid;
+       result->opfuncid = opform->oprcode;
        result->useOr = useOr;
        result->args = args;
 
@@ -1011,7 +1011,7 @@ make_op_expr(ParseState *pstate, Operator op,
        /* and build the expression node */
        result = makeNode(OpExpr);
        result->opno = oprid(op);
-       result->opfuncid = InvalidOid;
+       result->opfuncid = opform->oprcode;
        result->opresulttype = rettype;
        result->opretset = get_func_retset(opform->oprcode);
        result->args = args;
index 84c676604583a1c1c0d4a003af56c79f713c5a42..4ac876f0efa35e49e1783591d0c3f59df69a7338 100644 (file)
@@ -302,7 +302,7 @@ typedef struct FuncExpr
  *
  * Note that opfuncid is not necessarily filled in immediately on creation
  * of the node.  The planner makes sure it is valid before passing the node
- * tree to the executor, but during parsing/planning opfuncid is typically 0.
+ * tree to the executor, but during parsing/planning opfuncid can be 0.
  */
 typedef struct OpExpr
 {