Re: BUG #1335: Wrong sort result in union queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: snaky <snaky(at)ulstu(dot)ru>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1335: Wrong sort result in union queries
Date: 2004-12-01 15:54:29
Message-ID: 8560.1101916469@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> Union isn't a tool which gives you that ability. Union All is closer, but
> still doesn't guarantee an order.

The current implementation of UNION ALL will in fact act that way (just
append the individual query results together), but if for some reason we
decide to change it later, we'll be within the spec to do so. (I can't
imagine a reason to change it though...)

> This one is also okay. The order by in one wing does not control the
> output of the union. I believe supporting it is an extension in any case
> (at least SQL92 seems to make it illegal)

Yes. SQL92 believes strongly that row order is not significant, except
at the top level output of a query with ORDER BY ...

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-12-01 16:21:53 Re: BUG #1332: wrong results from age function
Previous Message Robert Grabowski 2004-12-01 15:52:52 Re: BUG #1332: wrong results from age function