Re: Unique Index

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Unique Index
Date: 2005-01-20 12:55:54
Message-ID: 20050120125550.GB12585@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 20, 2005 at 04:32:37PM +0900, Michael Glaesemann wrote:
>
> On Jan 20, 2005, at 16:03, David Garamond wrote:
>
> >Dann Corbit wrote:
> >>True, but the standard says nothing about the creation of an index, so
> >>you can make it behave in any way that you see fit.
> >
> >But I thought we are talking about unique _constraint_ here (which is
> >certainly regulated by the standard).
>
> They could conceivably be separated. The standard likewise doesn't say
> anything about how the unique constraint is enforced. In PostgreSQL, a
> "unique" index is used to enforce the constraint, but the unique index
> is not intrinsically tied to the unique constraint.

Ofcourse, but then you'd have to create another UNIQUE index type just
to handle the constraint, so you could define two types of unique:

CREATE UNIQUE INDEX blah on (...)
CREATE POSTGRESQL_STRANGE_UNIQUE INDEX blah on (...)

the former being used by CREATE CONSTRAINT. After all, we'd just be
incompatable with everyone else, no point using a standard keyword.

This is just more confusing when there are already perfectly workable
solutions to the problem as given. Don't use NULL when it's not
appropriate.

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Troyston Campano 2005-01-20 12:58:04 Re: [GENERAL] Oracle and Postgresql Play Nice Together on Same Computer?
Previous Message Martijn van Oosterhout 2005-01-20 12:42:29 Re: Multiline plpython procedure