Subject: Re: ERROR wrong varnullingrels (b 3) (expected (b)) with LEFT JOIN LATERAL and CTE

From: Tom Lane <[email-masked]>
Date: Thu, 28 Nov 2024 13:51:02 -0500

Bertrand Mamasam <[email-masked]> writes:
> Ok thank you, here is a short version of the query that works before 16.5
> but not in 16.5+ anymore.

Thanks for the test case!  A quick "git bisect" says I broke it at

cb8e50a4a09fe541e32cd54ea90a97f2924121a1 is the first bad commit
commit cb8e50a4a09fe541e32cd54ea90a97f2924121a1
Author: Tom Lane <[email-masked]>
Date:   Fri Aug 30 12:42:12 2024 -0400

    Avoid inserting PlaceHolderVars in cases where pre-v16 PG did not.

Apparently that change was less safe than I thought.  Looking ...

			regards, tom lane

---

From: Tom Lane <[email-masked]>
Date: Thu, 28 Nov 2024 17:35:25 -0500

> Apparently that change was less safe than I thought.  Looking ...

Fixed here:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=85990e2fd5610576635c65db9292297b1730c947

Thanks for the report!

			regards, tom lane

---

From: Bertrand Mamasam <[email-masked]>
Date: Fri, 29 Nov 2024 00:13:10 +0100

> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=85990e2fd5610576635c65db9292297b1730c947

Excellent ! Thank you very much !!!

Bertrand