Re: unique index on fields with possible null values

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: unique index on fields with possible null values
Дата
Msg-id 6521.1185504571@sss.pgh.pa.us
обсуждение исходный текст
Ответ на unique index on fields with possible null values  (Dmitry Ruban <dmitry@ruban.biz>)
Список pgsql-sql
Dmitry Ruban <dmitry@ruban.biz> writes:
> I'm trying to find a solution for unique index on fields with possible
> null values.

You appear to be hoping that a unique index would constrain a column to
contain at most one null entry.  It doesn't work like that, and I
strongly urge you to reconsider what you're using null for.  I think you
are in for a world of hurt, well beyond this one particular point,
because the SQL spec's semantics for null are not designed around the
idea that it represents a single distinguishable value.  What it
represents is "unknown".
        regards, tom lane


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

Предыдущее
От: Paul Lambert
Дата:
Сообщение: Re: Join question
Следующее
От: Stefan Zweig
Дата:
Сообщение: strange result for select * from table where id=random()*900