How does PostgreSQL treat null values in unique composite constraints???

From: P G <pg_dba(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How does PostgreSQL treat null values in unique composite constraints???
Date: 2003-04-08 18:12:35
Message-ID: 20030408181235.61841.qmail@web13309.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have the following table with a unique constraint.

create table testt (
id int,
aa int,
bb int,
constraint pk_testt primary key (id),
constraint cons_testt unique (aa,bb));

Let's say I insert the following:

insert into testt values (1,2,null);
insert into testt values (2,2,null);

I thought this should fail because of the unique
constraint, but it doesn't. How does PostgreSQL view
the null values in this constraint? Will someone
explain why I am allowed to make this insertion?

TIA.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Nichols 2003-04-08 18:19:00 Covariance Function in Postgresql??
Previous Message Dennis Gearon 2003-04-08 17:38:03 Re: transfer data