Re: INSERT ... ON CONFLICT syntax issues

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Andres Freund <andres(at)anarazel(dot)de>, Peter Geoghegan <pg(at)heroku(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Robert Haas <robertmhaas(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-04-27 17:20:05
Message-ID: 20150427172005.GA21038@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 26, 2015 at 09:34:12AM -0400, Stephen Frost wrote:
> * Heikki Linnakangas (hlinnaka(at)iki(dot)fi) wrote:
> > On 04/25/2015 12:01 PM, Andres Freund wrote:
> > >INSERT ... ON CONFLICT (cola, colb [WHERE predicate_for_partial]) UPDATE|IGNORE
> > >
> > >My problem with the WHERE being inside the parens in the above is that
> > >it's
> > >a) different from CREATE INDEX
> > >b) unclear whether the WHERE belongs to colb or the whole index
> > > expression. The equivalent for aggregates, which I bet is going to be
> > > used less often, caused a fair amount of confusing.
> > >
> > >That's why I wanted the WHERE outside the (), which requires either
> > >adding DO between the index inference clause, and the action, to avoid
> > >ambiguities in the grammar.
> >
> > Yeah, having the WHERE outside the parens seems much nicer. What is
> > the ambiguity?
>
> I like having it outside the parens also.

Agreed, and I like the DO [ UPDATE | NOTHING ] too.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-04-27 17:27:12 Re: pgsql: Add transforms feature
Previous Message Joel Jacobson 2015-04-27 16:47:20 Re: PL/pgSQL, RAISE and error context