Re: [HACKERS] DISTINCT and ORDER BY bug?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] DISTINCT and ORDER BY bug?
Дата
Msg-id 19716.949939003@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] DISTINCT and ORDER BY bug?  (Chris <chris@bitmead.com>)
Список pgsql-hackers
Chris <chris@bitmead.com> writes:
>> select distinct x from foo order by y;
>> 
>> which produces ill-defined results.

> Why is this ill-defined? If y is in x then it is also distinct

Huh?  The query specifies distinct values of x, and only x.
Consider    x    y
    1    1    1    10    2    0    2    11

"select distinct x" ought to produce one row with x=1, and one row with
x=2, and nothing else.  If it implicitly did the distinct on y as well,
you'd get four rows with two x=1 and two x=2, which is not my idea of
"distinct x".  But if you don't have four rows out, then there's no
meaningful way to order by y.

6.5.3 in fact produces four rows from this query, which is generally
conceded to be broken behavior.
        regards, tom lane


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

Предыдущее
От: Don Baccus
Дата:
Сообщение: Re: [HACKERS] follow-up on PC Week Labs benchmark results
Следующее
От: wieck@debis.com (Jan Wieck)
Дата:
Сообщение: Re: [HACKERS] New Globe