Re: INSERT ... ON CONFLICT syntax issues

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

On 05/06/2015 11:05 PM, Peter Geoghegan wrote:
> On Wed, May 6, 2015 at 7:53 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>>> In this variant, you explicitly specify the constraint by name.
>>
>> I do think it's a bit sad to not be able to specify unique indexes that
>> aren't constraints. So I'd like to have a corresponding ON INDEX - which
>> would be trivial.
>
> Then what's the point of having ON CONSTRAINT? The point of it working
> that way was we're not exposing the "implementation detail" of the
> index. While I happen to think that that's a distinction without a
> difference anyway, that certainly was the idea.

Right, that's the idea. Indexes are just an implementation detail -
conceivably you could have a constraint that's backed by some other
mechanism. You should not embed implementation details like index names
in your queries.

Unfortunately you can't create a "partial constraint" - you'll have to
create a partial index. I wish we would fix that directly, by allowing
partial unique constraints.

That said, I wouldn't necessarily be opposed to also having the syntax
to name an index directly, as long as we had some notices in the docs to
tell people to avoid it.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-05-06 21:13:13 Re: Disabling trust/ident authentication configure option
Previous Message Peter Geoghegan 2015-05-06 21:04:35 Re: INSERT ... ON CONFLICT syntax issues