From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Vladimir Terziev" <vlady(at)school(dot)digsys(dot)bg> |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] Question about SELECT and ORDER BY |
Date: | 2000-02-03 17:46:29 |
Message-ID: | 28465.949599989@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
"Vladimir Terziev" <vlady(at)school(dot)digsys(dot)bg> writes:
> I have a query:
> SELECT table1.attr1 AS ALIAS, attr2 from table1 UNION ALL
> SELECT table2.attr1, attr3 from table2 ORDER BY ALIAS;
> I want to have a result from ORDER BY length(ALIAS), but this is imposible.
SELECT ... UNION ... ORDER BY is pretty broken in current sources;
in particular adding a hidden column to sort on doesn't work when
there's a UNION. I've looked a little bit at fixing this, and it
looks like it will take the long-threatened querytree restructuring
to deal with it in any sensible fashion. Maybe that'll happen for 7.1.
In the meantime use Mark Volpe's workaround of only sorting on
columns that are in the select list.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Hollomon | 2000-02-03 17:47:18 | Re: [HACKERS] Re: [SQL] Proposed Changes to PostgreSQL |
Previous Message | Tom Lane | 2000-02-03 17:32:39 | Re: [HACKERS] Re: [SQL] Proposed Changes to PostgreSQL |