Re: Help with exclusion constraint

Поиск
Список
Период
Сортировка
От Moshe Jacobson
Тема Re: Help with exclusion constraint
Дата
Msg-id CAJ4CxLmQeCyxq=SHpO+ob7e5RCpYS6=we=FeyhY8AFPQ31QCvQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Help with exclusion constraint  (Igor Neyman <ineyman@perceptron.com>)
Список pgsql-general

On Fri, Mar 28, 2014 at 12:21 PM, Igor Neyman <ineyman@perceptron.com> wrote:
For this:
"any given value of fk_col that there is a maximum of one row with bool_col = true."

why don't you (instead) create partial unique index:
CREATE UNIQUE INDEX on exclusion_example(fk_col, bool_col) WHERE bool_col IS TRUE;

Ahh yes, why didn't I think of that? Thank you.


Moshe Jacobson
Manager of Systems Engineering, Nead Werx Inc.
2323 Cumberland Parkway · Suite 201 · Atlanta, GA 30339

"Quality is not an act, it is a habit." -- Aristotle

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

Предыдущее
От: hari.fuchs@gmail.com
Дата:
Сообщение: Re: Help with exclusion constraint
Следующее
От: Moshe Jacobson
Дата:
Сообщение: Re: Help with exclusion constraint