Re: unique constraint with a null column?

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: unique constraint with a null column?
Дата
Msg-id 20051230214133.GA11704@wolff.to
обсуждение исходный текст
Ответ на unique constraint with a null column?  (CSN <cool_screen_name90001@yahoo.com>)
Ответы Re: unique constraint with a null column?  (CSN <cool_screen_name90001@yahoo.com>)
Re: unique constraint with a null column?  ("Jim Buttafuoco" <jim@contactbda.com>)
Список pgsql-general
On Fri, Dec 30, 2005 at 13:30:40 -0800,
  CSN <cool_screen_name90001@yahoo.com> wrote:
> I have three columns, and one of them can be null. I'd
> like to create a unique constraint across all three
> columns and allow only one null value. e.g.
>
> a|b|c
> abc|123|null
> abc|123|null # not allowed
> abc|456|null
> abc|456|987
> abc|456|876
> def|456|null
> def|456|null # not allowed
>
> Currently, the 'not allowed' lines are allowed.

That is how 'unique' constraints are supposed to work. One possible
solution is to use some normal value instead of 'NULL' to represent
that fact.

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

Предыдущее
От: CSN
Дата:
Сообщение: unique constraint with a null column?
Следующее
От: CSN
Дата:
Сообщение: Re: unique constraint with a null column?