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