bug in "create unique index"

bug in "create unique index"

Post by Domingo Alvarez Duar » Mon, 14 May 2001 11:12:03



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

 
 
 

bug in "create unique index"

Post by Stephan Sza » Mon, 14 May 2001 13:39:42


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]


> 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


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

 
 
 

1. The "Edit"-method and an indexed, primary and unique field

I have been developing a databaseapp. in DAO and it works well - except in
one situation.

I have an indexed primary and unique field in the database
When I use "data1.edit" and edit the record (not the indexed field) and save
it by using "data1.update", I get the errormessage no.3022, saying that I
can't duplicate an indexed, unique field.

The first record in the database works OK, but when I get to no. 2,3,etc, I
get the errormessage.

Kind regards
Carsten Jensen

2. serial key in table that matches sort ordering

3. dBase "Unique" Index Problem

4. Problem: Creating table using SQL in Interbase....

5. Can I create "private" index

6. How to make logshipping backup infor not to fill up sql server logs

7. Stored Procedure for "Create Index On..."

8. mySQL(Linux) + Delphi

9. Generating "Create index" code

10. Drop Pk constraint says "CREATE INDEX"

11. max of ("...","...","..")

12. CREATE DATABASE creates "memory leak"

13. The "Edit"-method and an idexed, primary and unique field