Re: Unique Index

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Unique Index
Дата
Msg-id 87r7kgpuq8.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: Unique Index  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Unique Index
Список pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> "Dann Corbit" <DCorbit@connx.com> writes:
>
> > Even at that, I think that being able to insert more than one null value
> > into a unique index should be considered as a bug (or diagnosed as an
> > error).
>
> Direct your complaints to the ISO SQL standards committee.

The SQL standard generally treats NULLs as a escape hatch for constraints.

That's true for CHECK constraints as well: if you have a "CHECK a>0"
constraint but a is nullable then a NULL value is allowed even though the
check constraint can't be verified.

This isn't an unreasonable approach. Once you have NULLs it makes more sense
to make them useful than to treat them as just another value. You can always
make the column NOT NULL if you don't want any exceptions to your constraints.

--
greg

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

Предыдущее
От: Alex
Дата:
Сообщение: Re: Unique Index
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Ways to check the status of a long-running transaction