Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: bryan(dot)dicarlo(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error
Date: 2019-12-05 01:30:08
Message-ID: 11970.1575509408@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Peter Geoghegan <pg(at)bowt(dot)ie> writes:
> On Thu, Nov 28, 2019 at 10:26 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeremy Schneider 2019-12-05 01:36:16 logical decoding bug: segfault in ReorderBufferToastReplace()
Previous Message David G. Johnston 2019-12-05 01:15:55 Re: BUG #16149: Prepared COPY queries always report 0 parameters when described