From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Domingo Alvarez Duarte <domingo(at)dad-it(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: bug in "create unique index" |
Date: | 2001-05-13 03:50:39 |
Message-ID: | Pine.BSF.4.21.0105122046230.10564-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
This is correct by spec. NULLs are a special case.
From UNIQUE <table subquery) which unique constraints are defined
against:
2) If there are no two rows in T such that the value of each column
in one row is non-null and is equal to the value of the cor-
responding column in the other row according to Subclause 8.2,
"<comparison predicate>", then the result of the <unique predi-
cate> is true; otherwise, the result of the <unique predicate>
is false.
[This means that there will be no two rows such that the value
of each column in non-null and is equal to to the value in the
other since one of the columns is null]
On Sun, 13 May 2001, Domingo Alvarez Duarte wrote:
> when creating a index unique in a table that accept nulls the unique
> constraint doesn't work.
>
> Example:
> ---
> create table test_unique(i1 integer, i2 integer, unique(i1,i2);
> insert into test_unique(1,null);
> insert into test_unique(1,null);
> insert into test_unique(1,null);
> ---
> all "inserts" above insert sucefully.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-05-13 04:22:49 | Re: Postgres bug (working with iserverd) |
Previous Message | Andrew Bosma | 2001-05-13 03:25:42 | Re: State of PL/Python build |