Re: BUG #14089: ON CONFLICT allows function variables in index expressions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Alex Bolenok <quassnoi(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14089: ON CONFLICT allows function variables in index expressions
Date: 2016-04-16 02:22:46
Message-ID: CAKFQuwbob2Ko=XfovDvx4WdS=+TnBBJEwkjfzk0GC5Czucevcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Friday, April 15, 2016, Alex Bolenok <quassnoi(at)gmail(dot)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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2016-04-16 03:04:05 Re: PostgreSQL on Korean Windows Server 2008 R2 Standard
Previous Message Alex Bolenok 2016-04-15 22:21:44 Re: BUG #14089: ON CONFLICT allows function variables in index expressions