Re: BUG #18184: ERROR: wrong varnullingrels (b) (expected (b 3)) for Var 2/2
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: marian.krucina@linuxbox.cz, pgsql-bugs@lists.postgresql.org
Date: 2023-11-07T03:06:30Z
Lists: pgsql-bugs
Attachments
- v1-0001-Fix-mismatched-nullingrels-when-inlining-functions.patch (application/octet-stream) patch v1-0001
On Mon, Nov 6, 2023 at 10:39 PM PG Bug reporting form < noreply@postgresql.org> wrote: > Hi, > We found a bug in PostgreSQL 16. I have simplified the case: > > SELECT > function1(table1) > FROM table2 > LEFT JOIN table1 ON table1_id = table2_id > LEFT JOIN LATERAL (SELECT 1 FROM table3) AS tx3 ON (true) > LIMIT 5; > > ERROR: wrong varnullingrels (b) (expected (b 3)) for Var 2/2 Thanks for the report! This is an error message that hasn't been seen in a long time. It seems that when we optimize field selection from a whole-row Var into a simple Var while simplifying functions, we fail to propagate the nullingrels into the new Var. Attached is a hotfix for this error. But I'm wondering if there are other similar cases where we have mismatched nullingrels that we haven't discovered yet. Any thoughts? Thanks Richard
Commits
-
Fix computation of varnullingrels when const-folding field selection.
- 6bf2efb38285 16.2 landed
- 36f5594c0fe6 17.0 landed