Folks, I've been working with Andrew Gierth (well, mostly he's been doing the work, as usual) to add WITH ORDINALITY as an option for set-returning functions. In the process, he found a minor opportunity to clean up the interface for $SUBJECT, reducing the call to a Single Point of Truth for lateral-ness, very likely improving the efficiency of calls to that function.
Please find attached the patch. Cheers, David. -- David Fetter <da...@fetter.org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fet...@gmail.com iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
*** a/src/backend/parser/parse_clause.c --- b/src/backend/parser/parse_clause.c *************** *** 536,543 **** transformRangeFunction(ParseState *pstate, RangeFunction *r) /* * OK, build an RTE for the function. */ ! rte = addRangeTableEntryForFunction(pstate, funcname, funcexpr, ! r, r->lateral, true); /* * If a coldeflist was supplied, ensure it defines a legal set of names --- 536,542 ---- /* * OK, build an RTE for the function. */ ! rte = addRangeTableEntryForFunction(pstate, funcname, funcexpr, r, true); /* * If a coldeflist was supplied, ensure it defines a legal set of names *** a/src/backend/parser/parse_relation.c --- b/src/backend/parser/parse_relation.c *************** *** 1177,1183 **** addRangeTableEntryForFunction(ParseState *pstate, char *funcname, Node *funcexpr, RangeFunction *rangefunc, - bool lateral, bool inFromCl) { RangeTblEntry *rte = makeNode(RangeTblEntry); --- 1177,1182 ---- *************** *** 1285,1291 **** addRangeTableEntryForFunction(ParseState *pstate, * Functions are never checked for access rights (at least, not by the RTE * permissions mechanism). */ ! rte->lateral = lateral; rte->inh = false; /* never true for functions */ rte->inFromCl = inFromCl; --- 1284,1290 ---- * Functions are never checked for access rights (at least, not by the RTE * permissions mechanism). */ ! rte->lateral = rangefunc->lateral; rte->inh = false; /* never true for functions */ rte->inFromCl = inFromCl; *** a/src/include/parser/parse_relation.h --- b/src/include/parser/parse_relation.h *************** *** 61,67 **** extern RangeTblEntry *addRangeTableEntryForFunction(ParseState *pstate, char *funcname, Node *funcexpr, RangeFunction *rangefunc, - bool lateral, bool inFromCl); extern RangeTblEntry *addRangeTableEntryForValues(ParseState *pstate, List *exprs, --- 61,66 ----
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers