| From: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> |
|---|---|
| To: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
| Cc: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, 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 07:45:34 |
| Message-ID: | CAJTYsWX6YHo5NDeVUtq65vaKCL7=Z8X8-6MEfGqeL678E_Jbgg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Fri, 11 Sept 2026 at 09:30, Alexander Lakhin <exclusion(at)gmail(dot)com> wrote:
>
> 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
Thanks for the report.
ISTM virtual generated column is expanded to the tableoid reference, but the
EXCLUDED target list has no tableoid entry for setrefs.c to resolve.
Attached patch adds that entry and the statement you sent works fine with it.
Thoughts?
Regards,
Ayush
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-EXCLUDED-virtual-generated-columns-using-t.patch | application/octet-stream | 3.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-09-11 07:53:06 | Re: Add a permission check to pg_stat_get_backend_subxact() |
| Previous Message | Peter Smith | 2026-09-11 07:42:35 | Re: Review items for EXCEPT TABLE publication |