From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
---|---|
To: | Ron St-Pierre <rstpierre(at)syscor(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Constraint Problem |
Date: | 2003-11-04 19:03:17 |
Message-ID: | 20031104190317.GA11253@dcc.uchile.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Nov 04, 2003 at 10:25:03AM -0800, Ron St-Pierre wrote:
> Stephan Szabo wrote:
> CREATE TABLE compass (
> compassnID SERIAL PRIMARY KEY,
> company int4 NOT NULL REFERENCES tblcompanies (cntcompanyid),
> association int4 NOT NULL REFERENCES tblassociations
> (cntasncode),
> ysnDefault bool
> );
>
> CREATE UNIQUE INDEX compassoc_default_ind ON compass
> (company,association) WHERE ysnDefault;
>
> And as you can see company 23590 has three default associations. Any
> ideas on how I can get around this?
Well, shouldn't the index be
CREATE UNIQUE INDEX compassoc_default_ind ON compass (company) WHERE ysnDefault;
?
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Essentially, you're proposing Kevlar shoes as a solution for the problem
that you want to walk around carrying a loaded gun aimed at your foot.
(Tom Lane)
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2003-11-04 19:10:33 | Re: Constraint Problem |
Previous Message | Martin Marques | 2003-11-04 18:51:13 | Re: PostgreSQL v7.4 Release Candidate 1 |