| From: | "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> | 
|---|---|
| To: | pgsql-bugs(at)postgresql(dot)org | 
| Subject: | BUG #1335: Wrong sort result in union queries | 
| Date: | 2004-12-01 12:09:23 | 
| Message-ID: | 20041201120923.C8BCC7388A5@www.postgresql.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
The following bug has been logged online:
Bug reference:      1335
Logged by:          snaky
Email address: snaky(at)ulstu(dot)ru
PostgreSQL version: 8.0 Beta
Operating system: Windows 2003/XP
Description: Wrong sort result in union queries
Details:
sorry for my english.
Query:
select 2 union select 1
Result:
1
2
Why? I think the result must be like this:
2
1
Why PostgreSQL sort union queries by first column by default?
Certainly, I understand that I can write general "order by" in the end of 
query. However, in this case, I can't make queries with "manual" row ording. 
And what is more, this query does not work properly: 
(select * from (select 1, 2 union select 4, 3) as a
order by 2 desc)
union
select 1, 1
Result must be like this:
4, 3
1, 2
1, 1
but real result is:
1, 1
1, 2
4, 3
Full version info:
PostgreSQL 8.0.0beta1 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 
3.2.3 (mingw special 20030504-1) 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | simon | 2004-12-01 13:08:04 | Re: BUG #1335: Wrong sort result in union queries | 
| Previous Message | Magnus Hagander | 2004-12-01 10:21:27 | Re: Installation fails for postgresql-8.0.0-beta4 on Windo |