pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: holger.reise@vitagroup.ag
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18284: Filter in left lateral join not respected
Date: Fri, 12 Jan 2024 09:59:39 -0500
Message-ID: <465818.1705071579@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMbWs48r0MMEQoG8NWm7MTjDb_fbvCGEoYt_XpurDbrvuB5ZtA@mail.gmail.com>
References: <18284-47505a20c23647f8@postgresql.org>
	<74950.1704988899@sss.pgh.pa.us>
	<229608.1704994239@sss.pgh.pa.us>
	<CAMbWs48r0MMEQoG8NWm7MTjDb_fbvCGEoYt_XpurDbrvuB5ZtA@mail.gmail.com>

Richard Guo <guofenglinux@gmail.com> writes:
> On Fri, Jan 12, 2024 at 1:30 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Somehow that didn't cause any visible
>> problems before 4be058fe9, or more likely we just didn't get any
>> relevant trouble reports.

> I believe it should be the latter case.  It's not hard to show this
> problem before 4be058fe9.

> create table t (a int);
> insert into t values (1);

> # select t2a_lateral from t t1
>     left join (select coalesce(t2.a) as a from t t2) s on true
>     left join lateral (select s.a as t2a_lateral from t t3) ss on false;
>  t2a_lateral
> -------------
>            1
> (1 row)

Ah, of course.  The previous test case had FROM-less subselects,
so prior to 4be058fe9 we couldn't flatten those and the bug didn't
manifest.  But with ordinary FROM clauses, boom!

Now I'm fairly astonished that this was never reported before.
You'd think in ten years somebody would've noticed.

			regards, tom lane





view thread (5+ messages)

Message-ID: <465818.1705071579@sss.pgh.pa.us>
Permalink:  ../465818.1705071579@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/465818.1705071579@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, guofenglinux@gmail.com, holger.reise@vitagroup.ag, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18284: Filter in left lateral join not respected
  In-Reply-To: <465818.1705071579@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox