Re: BUG #15960: ON CONFLICT Trying accessing to variables

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org,Peter Geoghegan <pg(at)bowt(dot)ie>,anton(dot)dutov(at)gmail(dot)com,PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15960: ON CONFLICT Trying accessing to variables
Date: 2019-08-15 17:05:48
Message-ID: 34AB8A8F-1020-4800-9A06-577E038B3C50@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On August 15, 2019 9:17:36 AM PDT, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
>On Thu, Aug 15, 2019 at 6:28 AM PG Bug reporting form
><noreply(at)postgresql(dot)org> wrote:
>> Using upsert in stored procedure ON CONFLICT(id, ...) trows "ERROR:
>column
>> reference "id" is ambiguous" where id used as column name and as
>variable,
>> but ON CONFLICT can't use variables
>
>This is not a bug. You must resolve the ambiguity by using a plpgsql
>variable whose name isn't exactly the same as a column name.

I'm not sure I quite buy that. There is no actual ambiguity here. I don't buy the variable referencing a constant - that'd not correctly work for subsequent uses of the statement if the variable differs - don't think we'd have replacing etc set up. Nor do I think we would even evaluate The variable/param.

Seems like it's more a question of preventing the hook from resolving things at that point?

Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2019-08-15 17:09:14 Re: BUG #15960: ON CONFLICT Trying accessing to variables
Previous Message Peter Geoghegan 2019-08-15 16:17:36 Re: BUG #15960: ON CONFLICT Trying accessing to variables