List:General Discussion« Previous MessageNext Message »
From:<imre Date:December 11 2006 2:42pm
Subject:UNIQUE KEY vs NULLs
View as plain text  
Hi,

I have an InnoDB table similar to this:

CREATE TABLE Target
(IMSI VARCHAR(15) ASCII,
 IMEI VARCHAR(15) ASCII,
 UNIQUE KEY (IMSI, IMEI));

After playing a bit with it, I managed to add duplicate records, if one of
the fields was a NULL:

+-----------------+-----------------+
| IMSI            | IMEI            |
+-----------------+-----------------+
| NULL            | 35195600126418  |
| NULL            | 35195600126418  |
+-----------------+-----------------+


Is this a bug, or a feature? :-)

If it is a feature, than how can I assure uniqueness for a table in a sense
that won't allow such duplicates?

Thx

ImRe


Thread
UNIQUE KEY vs NULLsimre11 Dec
RE: UNIQUE KEY vs NULLsemierzwa11 Dec
Re: UNIQUE KEY vs NULLsDan Buettner11 Dec
  • RE: UNIQUE KEY vs NULLsimre12 Dec
Re: UNIQUE KEY vs NULLsMartijn Tonies11 Dec