diff options
author | unknown <kaa@polly.local> | 2007-05-31 14:54:44 +0400 |
---|---|---|
committer | unknown <kaa@polly.local> | 2007-05-31 14:54:44 +0400 |
commit | f18a10c6c1ced93a83ead017aa10398fa17c9a63 (patch) | |
tree | c04d9c8f5ce3a42514490e40b731a75e345d2c0b /mysql-test/t/heap_hash.test | |
parent | 37f5b4949e023f6999638d58378e8c76a41dc30f (diff) | |
download | mariadb-git-f18a10c6c1ced93a83ead017aa10398fa17c9a63.tar.gz |
Fix for bug #27643 "query failed : 1114 (The table '' is full)
Problem:
HASH indexes on VARCHAR columns with binary collations did not ignore trailing spaces from strings before comparisons. This could result in duplicate records being successfully inserted into a MEMORY table with unique key constraints.
As a direct consequence of the above, internal MEMORY tables used for GROUP BY calculation in testcases for bug #27643 contained duplicate rows which resulted in duplicate key errors when converting those temporary tables to MyISAM. Additionally, that error was incorrectly converted to the 'table is full' error.
Solution:
- ignore trailing spaces in VARCHAR fields with binary collations when calculating hashes.
- return a proper error from create_myisam_from_heap() when conversion fails.
mysql-test/r/ctype_ucs2_def.result:
Added a testcase for bug #27643.
mysql-test/r/heap_hash.result:
Added a testcase for bug #27643.
mysql-test/t/ctype_ucs2_def.test:
Added a testcase for bug #27643.
mysql-test/t/heap_hash.test:
Added a testcase for bug #27643.
sql/sql_select.cc:
Return an appropriate error instead of 'table is full' when conversion from MEMORY to MyISAM fails.
strings/ctype-bin.c:
Added my_hash_sort_8bit_bin() which ignores trailing spaces when calculating hashes, and is now used for VARCHAR columns instead of my_hash_sort_bin().
strings/ctype-mb.c:
Ignore trailing spaces when calculating a string hash in my_hash_sort_mb_bin().
strings/ctype-ucs2.c:
Ignore trailing spaces when calculating a string hash in my_hash_sort_ucs2_bin().
Diffstat (limited to 'mysql-test/t/heap_hash.test')
-rw-r--r-- | mysql-test/t/heap_hash.test | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test index 28a75a5ee11..c0f37fe490e 100644 --- a/mysql-test/t/heap_hash.test +++ b/mysql-test/t/heap_hash.test @@ -260,4 +260,27 @@ select a from t1 where a in (1,3); explain select a from t1 where a in (1,3); drop table t1; -# End of 4.1 tests +--echo End of 4.1 tests + +# +# Bug #27643: query failed : 1114 (The table '' is full) +# +# Check that HASH indexes disregard trailing spaces when comparing +# strings with binary collations + +CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + col2 VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; +INSERT INTO t1 VALUES('A', 'A'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES('A ', 'A '); +DROP TABLE t1; +CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, + col2 VARCHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, + UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; +INSERT INTO t1 VALUES('A', 'A'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES('A ', 'A '); +DROP TABLE t1; + +--echo End of 5.0 tests |