Re: Bug: aliasing in ORDER BY when UNIONing - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Bug: aliasing in ORDER BY when UNIONing
Date
Msg-id 20656.982545860@sss.pgh.pa.us
Whole thread Raw
In response to Bug: aliasing in ORDER BY when UNIONing  (Marko Kreen <marko@l-t.ee>)
Responses Re: Bug: aliasing in ORDER BY when UNIONing  (Marko Kreen <marko@l-t.ee>)
List pgsql-hackers
Marko Kreen <marko@l-t.ee> 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PHP 4.0.4pl1 / Beta 5
Next
From: Philip Warner
Date:
Subject: Re: GET DIAGNOSTICS (was Re: Open 7.1 items)