Re: Help with exclusion constraint

From: Moshe Jacobson <moshe(at)neadwerx(dot)com>
To: Igor Neyman <ineyman(at)perceptron(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Help with exclusion constraint
Date: 2014-03-28 16:59:17
Message-ID: CAJ4CxLmQeCyxq=SHpO+ob7e5RCpYS6=we=FeyhY8AFPQ31QCvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 28, 2014 at 12:21 PM, Igor Neyman <ineyman(at)perceptron(dot)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. <http://www.neadwerx.com>
2323 Cumberland Parkway · Suite 201 · Atlanta, GA 30339

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Moshe Jacobson 2014-03-28 17:00:20 Re: Help with exclusion constraint
Previous Message hari.fuchs 2014-03-28 16:45:16 Re: Help with exclusion constraint