Re: Re:BUG #18221: Unexpected Query Result

Поиск
Список
Период
Сортировка
От Ba Jinsheng
Тема Re: Re:BUG #18221: Unexpected Query Result
Дата
Msg-id SEZPR06MB64946F78596BF44C8753C5B58A86A@SEZPR06MB6494.apcprd06.prod.outlook.com
обсуждение исходный текст
Ответ на Re:BUG #18221: Unexpected Query Result  (Sergei Kornilov <sk@zsrv.org>)
Список pgsql-bugs
> Can you reproduce the unexpected behavior with explicit order by clause?
Oh yes. For this query, the unexpected behavior disappears.
SELECT DISTINCT ON (t2.c0) t2.c0, abs(t1.c0) FROM t1, t3, t2 ORDER BY t2.c0, t1.c0, t3.c0;


Thanks for explanation!


From: Sergei Kornilov <sk@zsrv.org>
Sent: Sunday, December 3, 2023 9:44 PM
To: PG Bug reporting form <noreply@postgresql.org>
Cc: Ba Jinsheng <bajinsheng@u.nus.edu>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re:BUG #18221: Unexpected Query Result
 
        - External Email -



Hello

Using "distinct on" without specifying an explicit "order by" is unpredictable in itself. I'll quote from the manual:

> Note that the “first row” of each set is unpredictable unless ORDER BY is used to ensure that the desired row appears first.

Can you reproduce the unexpected behavior with explicit order by clause?

regards, Sergei

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

Предыдущее
От: Jeff Laing
Дата:
Сообщение: RE: BUG #18219: libpq does not take into consideration UNICODE define
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #18222: Unexpected Error--Cannot delete from scalar