Re: BUG #18634: Wrong varnullingrels with merge ... when not matched by source
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2024-09-26T22:41:29Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes: > The following script: > CREATE TABLE t (a int); > INSERT INTO t VALUES(1), (2); > CREATE VIEW v AS SELECT a FROM t WHERE EXISTS (SELECT 1 FROM t); > MERGE INTO v USING (SELECT * FROM generate_series(1,1)) AS s(a) > ON s.a = v.a WHEN NOT MATCHED BY SOURCE THEN DELETE; > produces: > ERROR: XX000: wrong varnullingrels (b) (expected (b 4)) for Var 5/1 > LOCATION: search_indexed_tlist_for_var, setrefs.c:2847 I haven't run this fully to ground, but what it looks like is that preprocess_targetlist is generating row identity Vars that lack required varnullingrels. I don't understand though why this only seems to affect MERGE. regards, tom lane
Commits
-
Fix wrong varnullingrels error for MERGE WHEN NOT MATCHED BY SOURCE.
- 259a0a99fe3d 18.0 landed
- 34ae54af92e0 17.1 landed
-
Fix incorrect non-strict join recheck in MERGE WHEN NOT MATCHED BY SOURCE.
- dddb5640c6d3 18.0 landed
- d7d297f84496 17.1 landed