Re: [BUG] ON CONFLICT DO UPDATE SET x = EXCLUDED.<virtual-generated-column> errors or silently writes NULL

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [BUG] ON CONFLICT DO UPDATE SET x = EXCLUDED.<virtual-generated-column> errors or silently writes NULL
Date: 2026-09-11 04:00:01
Message-ID: 18fbeb33-9631-4f6e-9280-2c787aef254e@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Dean and Satyanarayana,

22.04.2026 11:12, Dean Rasheed wrote:
> On Mon, 20 Apr 2026 at 01:55, SATYANARAYANA NARLAPURAM
> <satyanarlapuram(at)gmail(dot)com> wrote:
>> Reran the failing tests and they all passed. Additionally ran the regression tests.
>> Patch looks good to me.
> Thanks for checking. Patch pushed and back-patched to v18.

Please look at a case broken by 783425175:
CREATE TABLE t (id int PRIMARY KEY, c int GENERATED ALWAYS AS (tableoid));
INSERT INTO t VALUES (1) ON CONFLICT (id) DO UPDATE SET id = 1 WHERE excluded.c > 0;

ERROR:  XX000: variable not found in subplan target lists
LOCATION:  fix_join_expr_mutator, setrefs.c:3229

At 783425175~1, it succeeds with:
INSERT 0 1

Best regards,
Alexander

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-09-11 04:03:43 Re: Review items for EXCEPT TABLE publication
Previous Message Jeevan Chalke 2026-09-11 03:58:34 Re: Add PRODUCT() aggregate function