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 3367ee2a875a39668a309b5e939a01312f4050b1..898c456b97174f745d04230fe9397d5b6c21f748 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.97 2007/11/15 21:14:37 momjian Exp $
+ *   $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.98 2007/11/22 19:40:25 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -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 4b940791a288f2a0b385d3441ad6c6402fbfb0e5..bc8064ece49b0d4db41c98927d36fd12cc850f51 100644 (file)
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.135 2007/11/15 22:25:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.136 2007/11/22 19:40:25 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -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
 {