Re: Removing unneeded self joins - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: Removing unneeded self joins
Date
Msg-id CAPpHfduYKqbWWT=YuBJyoExrwsJSgjUuJN1Gsr2YZMG=nh_ctQ@mail.gmail.com
Whole thread Raw
In response to Re: Removing unneeded self joins  (Alexander Lakhin <exclusion@gmail.com>)
Responses Re: Removing unneeded self joins
List pgsql-hackers
On Mon, Jan 8, 2024 at 10:00 PM Alexander Lakhin <exclusion@gmail.com> wrote:
> Please look at the following query which produces an incorrect result since
> d3d55ce57:
> CREATE TABLE t(a int PRIMARY KEY, b int);
> INSERT INTO t VALUES  (1, 1), (2, 1);
> SELECT * FROM t WHERE EXISTS (SELECT * FROM t t2 WHERE t2.a = t.b AND t2.b > 0);
>
>   a | b
> ---+---
>   1 | 1
> (1 row)
>
> I think that the expected result is:
>   a | b
> ---+---
>   1 | 1
>   2 | 1
> (2 rows)

Thank you for your report.  I'm looking at this now.

------
Regards,
Alexander Korotkov



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: verify predefined LWLocks have entries in wait_event_names.txt
Next
From: Joe Conway
Date:
Subject: Re: Emitting JSON to file using COPY TO