BUG #18091: Unexpected Result by enable_material

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: bajinsheng(at)u(dot)nus(dot)edu
Subject: BUG #18091: Unexpected Result by enable_material
Date: 2023-09-07 05:26:32
Message-ID: 18091-85d28443d2b0ba15@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18091
Logged by: Jinsheng Ba
Email address: bajinsheng(at)u(dot)nus(dot)edu
PostgreSQL version: 15.4
Operating system: Ubuntu
Description:

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}

Reproduction:
docker run -p 5432:5432 -e POSTGRES_PASSWORD=root -it postgres:latest
psql "postgresql://postgres:root(at)localhost:5432"

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2023-09-07 05:52:59 BUG #18092: Unexpected Result by enable_seqscan
Previous Message Kyotaro Horiguchi 2023-09-07 05:16:57 Re: BUG #18046: stats collection behaviour change is affecting the usability of information.