Re: Constraint question

From: Markus Schaber <schabi(at)logix-tt(dot)com>
To: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Constraint question
Date: 2006-05-19 08:38:43
Message-ID: 446D8413.8060303@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Kis János Tamás 2006-05-19 08:40:04 usernames of a group from SQL
Previous Message Thusitha Kodikara 2006-05-19 02:55:42 Re: Encryption functions