Marko Kreen <[EMAIL PROTECTED]> writes:
> What works:
> # select o.id from op o union all SELECT -1 order by id;

This is valid SQL.

> # select o.id from op o union all SELECT -1 order by o.id;
> ERROR:  Relation 'o' does not exist

This is not valid SQL.  For one thing, the table alias "o" is not
visible outside the first component SELECT.

Yes, I know 7.0 took it... but its handling of ORDER BY on UNION
was pretty darn broken.

                        regards, tom lane

Reply via email to