From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | bryan(dot)dicarlo(at)gmail(dot)com |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org, Peter Geoghegan <pg(at)bowt(dot)ie> |
Subject: | Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error |
Date: | 2019-11-28 18:26:33 |
Message-ID: | 24978.1574965593@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> When creating an updatable "complex" view, if an ON CONFLICT clause is
> provided, an INSERT SELECT to that view will cause "ERROR: variable not
> found in subplan target lists". Removing the ON CONFLICT clause eliminates
> the error message.
I believe the problem is that you wrote the ON CONFLICT clause
incorrectly:
> ON CONFLICT (slo_id, time_window, tags) DO UPDATE SET value = NEW.value
You should have written "EXCLUDED.value" not "NEW.value". There is
a bug here, but it's that the parser accepted this rule. I'm guessing
that the parsing logic for ON CONFLICT didn't consider the possibility
that NEW and OLD for a rule would already be in the range table.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bryan DiCarlo | 2019-11-28 19:21:24 | Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error |
Previous Message | Tom Lane | 2019-11-28 15:21:40 | Re: Numeric is not leakproof |