Skip site navigation (1) Skip section navigation (2)

Re: ORDER BY <field not in return list>

From: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
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:00:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Mon, Jul 25, 2005 at 06:11:08PM -0300, Marc G. Fournier wrote:
> 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 =
>      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 ...

Uh, I'd hope it had an effect. Note that RDBMSes have been moving
towards allowing fields in ORDER BY that aren't in the SELECT list,
though in the past it was common that anything in ORDER BY had to also
be in SELECT.
Jim C. Nasby, Database Consultant               decibel(at)decibel(dot)org 
Give your computer some brain candy! Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

In response to


pgsql-hackers by date

Next:From: Jim C. NasbyDate: 2005-07-25 22:02:02
Subject: Re: More buildfarm stuff
Previous:From: Jim C. NasbyDate: 2005-07-25 21:55:59
Subject: Re: regression failure on latest CVS

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group