Re: BUG #18091: Unexpected Result by enable_material

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: BUG #18091: Unexpected Result by enable_material
Дата
Msg-id CAMbWs49OsEPutOcYaWXUrph3Z-F0p_QsrF_P1kxGBPT5rc+vgA@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #18091: Unexpected Result by enable_material  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs

On Thu, Sep 7, 2023 at 3:10 PM PG Bug reporting form <noreply@postgresql.org> wrote:
Hello,

The same query returns different results when enable_material is changed:

CREATE TABLE t2(c1 DECIMAL, c2 serial);
CREATE TABLE t4(c0 TEXT);
INSERT INTO t2(c2) VALUES(1), (2);
INSERT INTO t2(c1) VALUES(0.1);
INSERT INTO t4(c0) VALUES('a'), ('b'), ('c');

SET enable_material=true;
SELECT DISTINCT ON (t2.c1) t2.c2 FROM t2, t4; -- {1}, {1}
SET enable_material=false;
SELECT DISTINCT ON (t2.c1) t2.c2 FROM t2, t4; -- {1}, {2}

With DISTINCT ON, only the first row of each set is kept, which is
unpredictable.  Usually you're supposed to use ORDER BY to get the
desired row.

Thanks
Richard

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

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: BUG #18092: Unexpected Result by enable_seqscan
Следующее
От: "Lepikhov Andrei"
Дата:
Сообщение: Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause