Question: Hey, I got a UNIQUE INDEX, but I can store multiple rows with the same value, NULL. That is surprising. Is that a bug?
This is a rewrite of the same in German from 9 years ago.
root@localhost [kris]> create table t ( a integer, b integer, unique (a,b));
Query OK, 0 rows affected (0.09 sec)
root@localhost [kris]> insert into t values (1, 2);
Query OK, 1 row affected (0.01 sec)
root@localhost [kris]> insert into t values (1, 2);
ERROR 1062 (23000): Duplicate entry '1-2' for key 't.a'
This does not work, as expected. But this does:
root@localhost [kris]> truncate table t;
Query OK, 0 rows affected (0.16 sec)
root@localhost [kris]> insert into t values ( 1, NULL);
Query OK, 1 row affected (0.02 sec)
root@localhost [kris]> insert into t values ( 1, NULL);
Query OK, 1 row affected (0.03 …[Read more]