Re: BUG #18522: Wrong results with Merge Right Anti Join, inconsistent with Merge Anti Join

Antti Lampinen <antti@lampinen.eu>

From: Antti Lampinen <antti@lampinen.eu>
To: Richard Guo <guofenglinux@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2024-06-25T04:24:05Z
Lists: pgsql-bugs
On Tue, Jun 25, 2024 at 5:07 AM Richard Guo <guofenglinux@gmail.com> wrote:
>
> On Tue, Jun 25, 2024 at 2:37 AM PG Bug reporting form
> <noreply@postgresql.org> wrote:
> > The following two queries result in different query plans and different
> > results, even though there is only a dummy condition change between them.
> > The
> > latter results are correct, there are two rows that match the conditions.
>
> Could you please provide the schema and necessary data for the two
> tables to reproduce this bug?  If there is a self-contained repro, that
> would be great.

I managed to create a self-contained repro:
https://gist.github.com/arlampin/0b86963694a936147383f3af3c83224c

This gives me consistently different results based on superfluous condition
change. See the two EXPLAIN queries in the sample.

Thanks,
Antti



Commits

  1. Fix right-anti-joins when the inner relation is proven unique