Re: BUG #15960: ON CONFLICT Trying accessing to variables - Mailing list pgsql-bugs

From Andres Freund
Subject Re: BUG #15960: ON CONFLICT Trying accessing to variables
Date
Msg-id 34AB8A8F-1020-4800-9A06-577E038B3C50@anarazel.de
Whole thread Raw
In response to Re: BUG #15960: ON CONFLICT Trying accessing to variables  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: BUG #15960: ON CONFLICT Trying accessing to variables  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-bugs
Hi,

On August 15, 2019 9:17:36 AM PDT, Peter Geoghegan <pg@bowt.ie> wrote:
>On Thu, Aug 15, 2019 at 6:28 AM PG Bug reporting form
><noreply@postgresql.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'dnot correctly work for subsequent uses of the statement if the variable differs - don't think we'd have replacing
etcset 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.



pgsql-bugs by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: BUG #15960: ON CONFLICT Trying accessing to variables
Next
From: Peter Geoghegan
Date:
Subject: Re: BUG #15960: ON CONFLICT Trying accessing to variables