Sam Mason <> writes:
> Tom Lane wrote:
>> It'd be nice to fix this someday, but don't hold your breath ...
> Is it even worth me thinking about trying to figure out how to make
> the current code do this sort of thing?
Probably not :-(. What we need is to integrate UNION (and the other
set-ops) into the normal querytree structure so that the planner can
consider alternative plans within its existing framework. That requires
some fundamental changes in the Query structure --- in particular, we
have to get rid of the current situation that there is exactly one
targetlist per rangetable. Decoupling targetlists and rangetables would
have some other benefits too (INSERT ... SELECT would get a lot cleaner)
but it's a wide-ranging change, and I think could only usefully be
tackled by someone who is already pretty familiar with the code.
regards, tom lane