BUG #18123: The execution plan for the left join is incorrect, returning incorrect rows of data.

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: dafoer_x(at)163(dot)com
Subject: BUG #18123: The execution plan for the left join is incorrect, returning incorrect rows of data.
Date: 2023-09-21 06:31:16
Message-ID: 18123-8604341c777ccee6@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: 18123
Logged by: The execution plan for the left join is incorrect, returning incorrect rows
of data.
Email address: dafoer_x(at)163(dot)com
PostgreSQL version: 14.0
Operating system: centos_x86
Description:

create table tb11(a int, b int);
insert into tb11 values(1,1);
select count(1) from tb11 a1 where a1.a =1;
select count(1) from tb11 a1 left join tb11 a2 on a1.a=a2.a where a1.a=1 and
a2.a=3;

postgres=# select count(1) from tb11 a1 where a1.a =1;
count
-------
1
(1 row)

postgres=# select count(1) from tb11 a1 left join tb11 a2 on a1.a=a2.a where
a1.a=1 and a2.a=3;
count
-------
0
(1 row)

postgres=# explain select count(1) from tb11 a1 left join tb11 a2 on
a1.a=a2.a where a1.a=1 and a2.a=3;
QUERY PLAN
------------------------------------------------
Aggregate (cost=0.00..0.01 rows=1 width=8)
-> Result (cost=0.00..0.00 rows=0 width=0)
One-Time Filter: false
(3 rows)

In the left join scenario, the conclusion of 'result = false' cannot be
obtained.
Could you please help analyze this issue?

Thank you.
dafoer

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2023-09-21 06:39:39 BUG #18124: PG16 release note document bug in "Add build option to allow testing of small WAL segment sizes"
Previous Message Peter Geoghegan 2023-09-21 04:58:10 Re: group by true now errors with non-integer constant in GROUP BY