"Oliver Elphick" <olly@lfix.co.uk> writes:
> In 6.5.3, it seems that UNION is not allowed inside a sub-select:
> Is this a permanent feature, an oversight, or something already on the TODO
> list?
The latter, as a moment's investigation would have shown you:
* Support UNION/INTERSECT/EXCEPT in sub-selects
Changing the grammar to allow it would be the work of a moment,
but the rewriter and other stages need more work. I've been putting
it off until we do the much-discussed, little-implemented querytree
representation redesign. It might be possible to fix this within the
current representation, but Except_Intersect_Rewrite() is so
ugly/grotty/broken that I don't really want to touch it until I can
discard it and rewrite from the ground up...
regards, tom lane