Re: disallowing multiple NULLs in a unique constraint

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: disallowing multiple NULLs in a unique constraint
Дата
Msg-id 9872.1076306232@sss.pgh.pa.us
обсуждение исходный текст
Ответ на disallowing multiple NULLs in a unique constraint  (David Garamond <lists@zara.6.isreserved.com>)
Ответы Re: disallowing multiple NULLs in a unique constraint  (David Garamond <lists@zara.6.isreserved.com>)
Список pgsql-general
David Garamond <lists@zara.6.isreserved.com> writes:
> SQL Server only allow one NULL in a unique constraint column (it's the
> unique index that does that, so the unique constraint behaves like that
> too). The question is, what is the best way to simulate that behaviour
> in Postgres?

The best way is to rewrite your app to not depend on nonstandard
semantics.  SQL Server is unquestionably violating the SQL spec here,
and it's not out of the question that Microsoft might realize that and
fix it, leaving you up the creek on that platform as well as Postgres.

Instead of using NULL in that fashion, perhaps you could choose a
non-null dummy value to use instead.

            regards, tom lane

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

Предыдущее
От: Lincoln Yeoh
Дата:
Сообщение: Re: Repost: postmaster growing to consume all memory
Следующее
От: Alex Satrapa
Дата:
Сообщение: Re: query progress indicator