Re: Problems with UNION ALL and ORDER BY - Mailing list pgsql-sql

From Kaloyan Iliev Iliev
Subject Re: Problems with UNION ALL and ORDER BY
Date
Msg-id 410E6E42.6030206@faith.digsys.bg
Whole thread Raw
In response to Re: Problems with UNION ALL and ORDER BY  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Problems with UNION ALL and ORDER BY  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Dear Tom,

As I say in my previous letter I am using 7.2.3. If you wish I can show 
you the query and the result to see for yourself, that there is 
something wrong. It just don't order the overall result but the separate 
results of the both subqueries.

Tom Lane wrote:

>Kaloyan Iliev Iliev <news1@faith.digsys.bg> writes:
>  
>
>> I have the following problem:
>>    
>>
>
>  
>
>>select
>>.....
>>from
>>....
>>where
>>....
>> UNION ALL
>>    
>>
>
>  
>
>>select
>>...
>>from
>>....
>>where
>>....
>>ORDER BY field1
>>    
>>
>
>  
>
>>But the the order by doesn't work properly. It returns the rows of the 
>>first query ordered and then appends the rows of the second query 
>>ordered.
>>    
>>
>
>Pray tell, what Postgres release are you using?
>
>AFAICT this will result in an overall sort in all PG releases since 7.0.
>I don't have anything older to test...
>
>            regards, tom lane
>
>
>  
>


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problems with UNION ALL and ORDER BY
Next
From: Gaetano Mendola
Date:
Subject: Re: Problems with UNION ALL and ORDER BY