Re: UNION and ORDER BY ... IS NULL ASC

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: josh(at)agliodbs(dot)com
Cc: "A(dot)M(dot)" <agentm(at)cmu(dot)edu>, pgsql-sql(at)postgresql(dot)org
Subject: Re: UNION and ORDER BY ... IS NULL ASC
Date: 2003-04-05 04:17:40
Message-ID: 11805.1049516260@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Josh Berkus <josh(at)agliodbs(dot)com> writes:
>> ERROR: ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of
>> the result columns

> I do believe that this is per the SQL spec; UNIONs may only be sorted on the
> output columns.

Right. We extend the SQL spec for ORDER BY on simple selects, but we
have not gotten around to doing so for ORDER BY on set-operation
results. You can only sort by unadorned output columns.

Patches to improve this are welcome ;-)

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message CIC mail 2003-04-05 20:47:44 unscribe
Previous Message Josh Berkus 2003-04-05 02:52:30 Re: UNION and ORDER BY ... IS NULL ASC