Re: Removing unneeded self joins

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: Andrei Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>, "Gregory Stark (as CFM)" <stark(dot)cfm(at)gmail(dot)com>, Michał Kłeczek <michal(at)kleczek(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Richard Guo <guofenglinux(at)gmail(dot)com>
Subject: Re: Removing unneeded self joins
Date: 2024-01-08 22:09:49
Message-ID: CAPpHfdvu+wyazT+ujJbJ5rKZrHQoG+FCVeWENA4pyf_A1W1WAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 8, 2024 at 10:20 PM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
> On Mon, Jan 8, 2024 at 10:00 PM Alexander Lakhin <exclusion(at)gmail(dot)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.

Fixed in 30b4955a46.

------
Regards,
Alexander Korotkov

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-01-08 22:39:04 Re: Fix bogus Asserts in calc_non_nestloop_required_outer
Previous Message Nathan Bossart 2024-01-08 22:02:12 Re: verify predefined LWLocks have entries in wait_event_names.txt