Re: ORDER BY

Поиск
Список
Период
Сортировка
От Marc G. Fournier
Тема Re: ORDER BY
Дата
Msg-id 20050725190512.Q54567@svr1.postgresql.org
обсуждение исходный текст
Ответ на ORDER BY  ("Marc G. Fournier" <scrappy@postgresql.org>)
Список pgsql-hackers

On Mon, 25 Jul 2005, Jim C. Nasby wrote:

> 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 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 ...
>
> 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.

'k, in the test case I've been working with, the query always returns 1 
row, so my test case wouldn't have shown a difference ... but, if it does 
have an affect, how?  The ORDER BY is on the final result set, and if 
there is no cs.fullname in that result, what exactly is it ordering?



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: ORDER BY
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: More buildfarm stuff