Re: Bug: aliasing in ORDER BY when UNIONing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marko Kreen <marko(at)l-t(dot)ee>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bug: aliasing in ORDER BY when UNIONing
Date: 2001-02-19 01:24:20
Message-ID: 20656.982545860@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marko Kreen <marko(at)l-t(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2001-02-19 01:33:26 Re: GET DIAGNOSTICS (was Re: Open 7.1 items)
Previous Message Tom Lane 2001-02-19 01:19:15 Re: PHP 4.0.4pl1 / Beta 5