From: Tom Lane Date: Thu, 22 Nov 2007 19:40:25 +0000 (+0000) Subject: Actually ... it's pretty silly that parse_oper.c doesn't set up the X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=c2f144511e50fa247c2ffbae44787403d33c47eb;p=users%2Fbernd%2Fpostgres.git Actually ... it's pretty silly that parse_oper.c doesn't set up the 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. --- diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c index 57a73989f0..257c3bac65 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -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; diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 84c6766045..4ac876f0ef 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -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 {