Re: Unique Index

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Unique Index
Дата
Msg-id 20050120125550.GB12585@svana.org
обсуждение исходный текст
Ответ на Re: Unique Index  (Michael Glaesemann <grzm@myrealbox.com>)
Список 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@svana.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.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Vittorio
Дата:
Сообщение: Re: Best Linux Distribution
Следующее
От: "Troyston Campano"
Дата:
Сообщение: Re: Oracle and Postgresql Play Nice Together on Same Computer?