unique constraint with a null column?

From: CSN <cool_screen_name90001(at)yahoo(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: unique constraint with a null column?
Date: 2005-12-30 21:30:40
Message-ID: 20051230213040.32618.qmail@web52906.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have three columns, and one of them can be null. I'd
like to create a unique constraint across all three
columns and allow only one null value. e.g.

a|b|c
abc|123|null
abc|123|null # not allowed
abc|456|null
abc|456|987
abc|456|876
def|456|null
def|456|null # not allowed

Currently, the 'not allowed' lines are allowed.

thanks
csn



__________________________________
Yahoo! for Good - Make a difference this year.
http://brand.yahoo.com/cybergivingweek2005/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message CSN 2005-12-30 21:40:55 Re: unique constraint with a null column?
Previous Message Robert Treat 2005-12-30 20:55:16 Re: Forum Software