Re: Constraint Problem
От | Alvaro Herrera |
---|---|
Тема | Re: Constraint Problem |
Дата | |
Msg-id | 20031104190317.GA11253@dcc.uchile.cl обсуждение исходный текст |
Ответ на | Re: Constraint Problem (Ron St-Pierre <rstpierre@syscor.com>) |
Список | 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)
В списке pgsql-general по дате отправления: