Re: INSERT ... ON CONFLICT syntax issues

From: Andres Freund <andres(at)anarazel(dot)de>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Geoghegan <pg(at)heroku(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Subject: Re: INSERT ... ON CONFLICT syntax issues
Date: 2015-05-07 17:37:22
Message-ID: 20150507173722.GD12950@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-05-07 16:15:18 +0300, Heikki Linnakangas wrote:
> On 05/07/2015 12:01 AM, Andres Freund wrote:
> >6. The tablename and EXCLUDED? Possibility with the ability to specify
> > an AS for INSERT INTO foo AS whatever?
>
> If we don't allow "AS whatever", and you create a table called "excluded",
> you're stuck with the ambiguity in the DO UPDATE statement as you can't
> alias either one. So we have to add support for "INSERT INTO foo AS
> whatever", if we go with <tablename> and EXCLUDED.
>
> Does anyone see a problem with "INSERT INTO foo AS whatever"? It seems
> pretty straightforward to implement.

I don't see a problem at all, with one exception: If we want the AS to
be optional like in a bunch of other places, we have to either promote
VALUES to a reserved keyword, only accept unreserved keywords, or play
precedence games. I think it'd be perfectly fine to not make AS
optional.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2015-05-07 17:41:04 Re: INSERT ... ON CONFLICT syntax issues
Previous Message Alvaro Herrera 2015-05-07 16:06:11 Re: BRIN range operator class