From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: bryan.dicarlo@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error
Date: Wed, 04 Dec 2019 20:30:08 -0500
Message-ID: <11970.1575509408@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH2-Wzmfmx_YpAEFGS1rhG_-hdkGfO0yx0hZhxYD0+ww3A5RZA@mail.gmail.com>
References: <16140-4d29cf5390118372@postgresql.org>
<24978.1574965593@sss.pgh.pa.us>
<CAH2-Wzmfmx_YpAEFGS1rhG_-hdkGfO0yx0hZhxYD0+ww3A5RZA@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, pg@bowt.ie
Subject: Re: BUG #16140: View with INSERT, DO INSTEAD, and ON CONFLICT causes an error
In-Reply-To: <11970.1575509408@sss.pgh.pa.us>
References: <16140-4d29cf5390118372@postgresql.org> <24978.1574965593@sss.pgh.pa.us> <CAH2-Wzmfmx_YpAEFGS1rhG_-hdkGfO0yx0hZhxYD0+ww3A5RZA@mail.gmail.com> <11970.1575509408@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox