| От | hubert depesz lubaczewski |
|---|---|
| Тема | Re: unique constraint with significant nulls? |
| Дата | |
| Msg-id | 20120925153257.GA20437@depesz.com обсуждение исходный текст |
| Ответ на | unique constraint with significant nulls? (Mike Blackwell <mike.blackwell@rrd.com>) |
| Ответы |
Re: unique constraint with significant nulls?
|
| Список | pgsql-general |
On Tue, Sep 25, 2012 at 10:05:15AM -0500, Mike Blackwell wrote:
> How would one go about building a multi-column unique constraint where null
> is a significant value, eg. (1, NULL) <> (2, NULL)?
>
> I see a number of references to not being able to use an index for this,
> but no mention of an alternative. Any pointers would be appreciated
create unique index zzz on table ((column is null), coalesce(column, 'whatever'));
Best regards,
depesz
--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера