Re: ORDER BY - Mailing list pgsql-hackers

From Marc G. Fournier
Subject Re: ORDER BY
Date
Msg-id 20050725192419.V54567@svr1.postgresql.org
Whole thread Raw
In response to ORDER BY  ("Marc G. Fournier" <scrappy@postgresql.org>)
List pgsql-hackers

On Mon, 25 Jul 2005, Jeffrey W. Baker wrote:

> On Mon, 2005-07-25 at 19:08 -0300, Marc G. Fournier wrote:
>>
>> On Mon, 25 Jul 2005, Jeffrey W. Baker wrote:
>>
>>> On Mon, 2005-07-25 at 18:11 -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 c.id = cs.id
>>>>       AND cs.detail = 'test'
>>>> ORDER BY cs.fullname;
>>>
>>> Seems like it should work.  Is it not returning in fullname order in
>>> your tests?
>>
>> Full name isn't a field in the results, so how would it be ORDERing based
>> on it?  fullname is a field in the table being joined in order to restrict
>> the results to just those with cs.detail = 'test' ... but company itself
>> doesn't have a field fullname ...
>
> I'm still not seeing the problem.  cs.fullname is in the product of the
> join, and you can order the result thereby, and not return the column.

That's what I was missing ... "the product of the join" ... I was seeing 
the end result as being all that an ORDER BY had to work with, vs the JOIN 
of all the tables ...



pgsql-hackers by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: More buildfarm stuff
Next
From: "Jeffrey W. Baker"
Date:
Subject: Re: ORDER BY