Re: Promise index tuples for UPSERT

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>, Anssi Kääriäinen <anssi(dot)kaariainen(at)thl(dot)fi>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)2ndquadrant(dot)com>
Subject: Re: Promise index tuples for UPSERT
Date: 2014-10-08 08:25:59
Message-ID: 5434F517.8070009@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/08/2014 11:10 AM, Peter Geoghegan wrote:
> The reasoning behind making the unique index specification optional is:
>
> We cannot easily cover corner cases with another syntax - unique
> indexes must be named directly to cover every case, and make the
> user's intent absolutely clear. That's not obviously the case, but
> consider partial unique indexes, for example. Or consider uniquely
> constrained columns, with an almost equivalent uniquely constrained
> expression on those same columns. On the one hand I am not comfortable
> failing to support those, but on the other hand it could get very
> messy to do it another way.
>
> As we all know, naming a unique index in DML is ugly, and has poor
> support in ORMs.

I vehemently object to naming indexes in the UPSERT statement. That
mixes logical and physical database design, which is a bad idea. This is
not ISAM.

Instead of naming the index, you should name the columns, and the system
can look up the index or indexes that match those columns.

(Remind me again, where did this need to name an index come from in the
first place?)

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marti Raudsepp 2014-10-08 08:36:49 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Previous Message Peter Geoghegan 2014-10-08 08:10:26 Re: Promise index tuples for UPSERT