Attached is the result of a couple of days hacking on the WITH RECURSIVE patch. This moves us a lot closer to having sanity in the parsing phase, though I'm still quite unhappy with the second half of the processing in parse_cte.c. I added some infrastructure to make the first half's search for CTE references reasonably bulletproof, but the second half needs to be converted to use the same infrastructure, and I didn't do that yet because I didn't understand what it was doing. In particular, what the heck is the exception in findCteName that allows some other CTE's non_recursive_term to be stored into the non_recursive_term for the current one? That seems mighty broken.
There are a number of unfinished corner cases (look for XXX in the patch) but they aren't in the way of further progress. The next big thing seems to be to figure out exactly how to do multiple references to CTE outputs, so that we can de-bogotify the planner. regards, tom lane
bintORC4R6tx5.bin
Description: cte-0923.patch.gz
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers