Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware)

Andrei Lepikhov <a.lepikhov@postgrespro.ru>

From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2023-04-21T12:11:04Z
Lists: pgsql-bugs
On 4/21/23 14:34, Richard Guo wrote:
> 
> On Thu, Apr 20, 2023 at 1:06 PM Andrey Lepikhov 
> <a.lepikhov@postgrespro.ru <mailto:a.lepikhov@postgrespro.ru>> wrote:
> Are you worried about upper clauses who reference to C vars?  In the
> second form when we've formed A/B join, which would have both outer
> joins' relids in its relid set, the upper clause will be able to be
> applied there, and it is the correct join level.
Yes, of course. I thought about the case with INNER JOINs in between, 
something like that:
a LEFT JOIN b ON b.x INNER JOIN c ON (b.x=c.x) LEFT JOIN d ON b.x ...
But, it is still a doubt.
> 
> BTW, cfbot reminds that a rebase is needed.  So re-attach the two
> patches.  Now I think it should be in 'Needs review' again in CF.  I'll
> go and do the change.
Thanks!

-- 
Regards
Andrey Lepikhov
Postgres Professional




Commits

  1. Fix thinko in join removal.

  2. Convert nullingrels match checks from Asserts to test-and-elog.

  3. Fix some issues with improper placement of outer join clauses.