Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
> It's a real pita to flatten the join expressions into the traditional
> Postgres query tree. It would be nice to start thinking about how to
> represent general subqueries or intermediate queries in the parse
> tree.
Yes. Jan has been saying for some time that he needs that for rules.
Also, I have found some squirrely cases in INSERT ... SELECT ... that
can't really be done right unless the INSERT and SELECT targetlists
are kept separate, which seems to mean a two-level parsetree structure.
The UNION/INTERSECT/EXCEPT code has a really klugy approach to
multi-query parse trees, which maybe could be cleaned up if we
supported them in a more general fashion.
Maybe it's time to bite the bullet and do it. You have any thoughts
on what the representation should look like?
regards, tom lane