[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    Re: [SQL] Constraint question
From:       Markus Schaber <schabi () logix-tt ! com>
Date:       2006-05-19 8:38:43
Message-ID: 446D8413.8060303 () logix-tt ! com
[Download RAW message or body]

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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic