Re: Adding UNIQUE constraint on NULL column

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Adding UNIQUE constraint on NULL column
Дата
Msg-id 20050113171658.GB13594@wolff.to
обсуждение исходный текст
Ответ на Adding UNIQUE constraint on NULL column  (Dave Smith <dave.smith@candata.com>)
Список pgsql-general
On Thu, Jan 13, 2005 at 09:01:08 -0500,
  Dave Smith <dave.smith@candata.com> wrote:
> I am trying to add a unique constraint on a column that can be null. The
> documentation states that null is treated as non equal values but I want
> them to be equal. Is there another way of doing this other than writing
> a before insert trigger?

I think you will need an after trigger to enforce that.
You might also consider using some other value than NULL. If other tables
are going to reference this one using the unique column, potentially having
a NULL could be a problem.

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

Предыдущее
От: John Cunningham
Дата:
Сообщение: pgpool
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: vacuum vs open transactions