Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error
Date
Msg-id 11970.1575509408@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causesan error  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-bugs
Peter Geoghegan <pg@bowt.ie> writes:
> On Thu, Nov 28, 2019 at 10:26 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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.

> I must admit that I have zero recollection of this aspect of the ON
> CONFLICT work. Do you think that this would be difficult to fix?

Probably not terribly so, but I haven't looked at the code.  Partly
it'd depend on how good an error message we want (e.g., whether there's
to be an error cursor).  The likely-simplest fix would involve making
sure the rangetable has only the two useful entries, so you'd get
some sort of "unknown table name" error for mistakes of this sort.
It'd be more useful to say something like "only <table name> and
EXCLUDED can be referenced in ON CONFLICT"; but getting to that
might be more trouble than it's worth.

            regards, tom lane



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #16149: Prepared COPY queries always report 0 parameters when described
Next
From: Jeremy Schneider
Date:
Subject: logical decoding bug: segfault in ReorderBufferToastReplace()