From: | Tino Wildenhain <tino(at)wildenhain(dot)de> |
---|---|
To: | "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: ORDER BY <field not in return list> |
Date: | 2005-07-25 22:17:24 |
Message-ID: | 1122329844.30587.100.camel@Andrea.peacock.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Am Montag, den 25.07.2005, 18:11 -0300 schrieb Marc G. Fournier:
> Just curious as to whether or not a warning or something should be issued
> in a case like:
>
> SELECT c.*
> FROM company c, company_summary cs
> WHERE c.id = cs.id
> AND cs.detail = 'test'
> ORDER BY cs.fullname;
>
> Unless I'm missing something, the ORDER BY clause has no effect, but an
> EXPLAIN shows it does take extra time, obviously ...
It just does the sorting as you requested. Check the order of
the resulting c.id.
See:
experiment=# SELECT * FROM A;
a_id | a_value
------+---------
1 | abc
2 | bcd
3 | def
(3 rows)
experiment=# SELECT * FROM B;
b_id | b_value
------+---------
1 | xyz
2 | ijk
3 | abc
(3 rows)
experiment=# SELECT a.* FROM a,b WHERE a.a_id=b.b_id ORDER BY b_value;
a_id | a_value
------+---------
3 | def
2 | bcd
1 | abc
(3 rows)
So no reason for warnings :-)
From | Date | Subject | |
---|---|---|---|
Next Message | Jeffrey W. Baker | 2005-07-25 22:22:54 | Re: ORDER BY <field not in return list> |
Previous Message | Jim C. Nasby | 2005-07-25 22:15:25 | Re: [HACKERS] Patch to fix plpython on OS X |