pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18634: Wrong varnullingrels with merge ... when not matched by source
Date: Thu, 26 Sep 2024 18:41:29 -0400
Message-ID: <374420.1727390489@sss.pgh.pa.us> (raw)
In-Reply-To: <18634-db5299c937877f2b@postgresql.org>
References: <18634-db5299c937877f2b@postgresql.org>

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





view thread (9+ messages)  latest in thread

Message-ID: <374420.1727390489@sss.pgh.pa.us>
Permalink:  ../374420.1727390489@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/374420.1727390489@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, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18634: Wrong varnullingrels with merge ... when not matched by source
  In-Reply-To: <374420.1727390489@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