Re: BUG #14089: ON CONFLICT allows function variables in index expressions - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #14089: ON CONFLICT allows function variables in index expressions
Date
Msg-id CAKFQuwbob2Ko=XfovDvx4WdS=+TnBBJEwkjfzk0GC5Czucevcg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #14089: ON CONFLICT allows function variables in index expressions  (Alex Bolenok <quassnoi@gmail.com>)
Responses Re: BUG #14089: ON CONFLICT allows function variables in index expressions
List pgsql-bugs
On Friday, April 15, 2016, Alex Bolenok <quassnoi@gmail.com> wrote:

> The function should not even compile, as the INSERT query before it does
> not:
>
> test=# INSERT INTO test (value) SELECT * FROM (VALUES (1)) q (n) ON
> CONFLICT
> (value, (n)) DO NOTHING;
> ERROR:  column "n" does not exist
>
> The parser should only allow the target table's column names and constants
> in the index expression, as it does when creating the index. A variable
> name is neither.
>
>
The parsed insert never see the letter "n".  Once you comprehend that fact
your statement is true - because of the word "constant".  That constant is
why it compiles.

David J.

pgsql-bugs by date:

Previous
From: Alex Bolenok
Date:
Subject: Re: BUG #14089: ON CONFLICT allows function variables in index expressions
Next
From: Noah Misch
Date:
Subject: Re: PostgreSQL on Korean Windows Server 2008 R2 Standard