Re: Wrong results with right-semi-joins - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Wrong results with right-semi-joins
Date
Msg-id CAMbWs48dcaBS1zHMG3j4oMGsQtjTidmbB2nkZZJwFv7aj8jNCw@mail.gmail.com
Whole thread Raw
In response to Re: Wrong results with right-semi-joins  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Wrong results with right-semi-joins
List pgsql-hackers
On Wed, Dec 11, 2024 at 11:27 AM Richard Guo <guofenglinux@gmail.com> wrote:
> I spent some time on this and came up with a simpler query to
> reproduce the issue.
>
> explain (costs off)
> select * from tbl_rs t1 join
>   lateral (select * from tbl_rs t2 where t2.a in
>             (select t1.a+t3.a from tbl_rs t3) and t2.a < 5)
>   on true;
>                 QUERY PLAN
> -------------------------------------------
>  Nested Loop
>    ->  Seq Scan on tbl_rs t1
>    ->  Hash Right Semi Join
>          Hash Cond: ((t1.a + t3.a) = t2.a)
>          ->  Seq Scan on tbl_rs t3
>          ->  Hash
>                ->  Seq Scan on tbl_rs t2
>                      Filter: (a < 5)
> (8 rows)
>
> Without the fix, this query returns 3 rows rather than the expected 6.
>
> Maybe I should update the test case introduced in 5668a857d to this
> one.

Done.

Thanks
Richard



pgsql-hackers by date:

Previous
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Adding a '--two-phase' option to 'pg_createsubscriber' utility.
Next
From: Tom Lane
Date:
Subject: Re: pg_createsubscriber TAP test wrapping makes command options hard to read.