Commit ca88ca16 authored by unknown's avatar unknown

BUG#12873 - BTREE index on MEMORY table with multiple NULL values

            doesn't work properly

Unique BTREE index on MEMORY table refuse multiple NULL values.

Fixed search_flag to allow multiple null values inside unique key.


heap/hp_write.c:
  Fixed search_flag to allow multiple null values inside unique key.
mysql-test/r/heap_btree.result:
  Testcase for BUG#12873.
mysql-test/t/heap_btree.test:
  Testcase for BUG#12873.
parent 60bb69aa
...@@ -105,7 +105,7 @@ int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record, ...@@ -105,7 +105,7 @@ int hp_rb_write_key(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *record,
custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos); custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos);
if (keyinfo->flag & HA_NOSAME) if (keyinfo->flag & HA_NOSAME)
{ {
custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME | SEARCH_UPDATE; custom_arg.search_flag= SEARCH_FIND | SEARCH_UPDATE;
keyinfo->rb_tree.flag= TREE_NO_DUPS; keyinfo->rb_tree.flag= TREE_NO_DUPS;
} }
else else
......
...@@ -256,3 +256,6 @@ SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() ...@@ -256,3 +256,6 @@ SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE()
INDEX_LENGTH INDEX_LENGTH
21 21
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
...@@ -176,4 +176,12 @@ UPDATE t1 SET val=1; ...@@ -176,4 +176,12 @@ UPDATE t1 SET val=1;
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1'; SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
DROP TABLE t1; DROP TABLE t1;
#
# BUG#12873 - BTREE index on MEMORY table with multiple NULL values doesn't
# work properly
#
CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment