| From: | Moshe Jacobson <moshe(at)neadwerx(dot)com> |
|---|---|
| To: | hari(dot)fuchs(at)gmail(dot)com |
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Help with exclusion constraint |
| Date: | 2014-03-28 17:00:20 |
| Message-ID: | CAJ4CxL=0iDwJP8DoNpMdkYyE8enV_6wWdRL__3q96nzS2FqP_Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Fri, Mar 28, 2014 at 12:45 PM, <hari(dot)fuchs(at)gmail(dot)com> wrote:
> > I want to ensure that for any given value of fk_col that there is a
> maximum
> > of one row with bool_col = true.
>
> This should be what you want:
>
> ALTER TABLE exclusion_example
> ADD CONSTRAINT ex
> EXCLUDE (fk_col WITH =) WHERE (bool_col);
Yes, that would do the trick!
I think I'll just set up a partial unique index as per Igor's suggestion,
however.
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kevin Goess | 2014-03-28 17:35:20 | upgrading from debian 6 to 7--do in place or wipe-and-install? |
| Previous Message | Moshe Jacobson | 2014-03-28 16:59:17 | Re: Help with exclusion constraint |