Re: Constraint question - Mailing list pgsql-sql

From Markus Schaber
Subject Re: Constraint question
Date
Msg-id 446D8413.8060303@logix-tt.com
Whole thread Raw
In response to Re: Constraint question  (Andreas Joseph Krogh <andreak@officenet.no>)
List pgsql-sql
Hi, Andreas,

Andreas Joseph Krogh wrote:

>>CREATE UNIQUE INDEX foo ON onp_crm_businessfield_company(company_id)
>>WHERE is_prefferred;

> I also figured out that an index like this also works:
> UNIQUE(company_id, is_preferred)
> This works because NULL = NULL is false. But I guess your solution is cleaner.

Yes, it works, but it needs more disk space (it has to index all rows,
and it needs to save both columns), and thus is slower, too.

HTH,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org


pgsql-sql by date:

Previous
From: Andreas Joseph Krogh
Date:
Subject: Re: Constraint question
Next
From: Kis János Tamás
Date:
Subject: usernames of a group from SQL