mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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().
This commit is contained in:
@ -271,6 +271,29 @@ static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
|
||||
}
|
||||
|
||||
|
||||
void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const uchar *key, uint len,ulong *nr1, ulong *nr2)
|
||||
{
|
||||
const uchar *pos = key;
|
||||
|
||||
key+= len;
|
||||
|
||||
/*
|
||||
Remove trailing spaces. We have to do this to be able to compare
|
||||
'A ' and 'A' as identical
|
||||
*/
|
||||
while (key > pos && key[-1] == ' ')
|
||||
key--;
|
||||
|
||||
for (; pos < (uchar*) key ; pos++)
|
||||
{
|
||||
nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *
|
||||
((uint)*pos)) + (nr1[0] << 8);
|
||||
nr2[0]+=3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const uchar *key, uint len,ulong *nr1, ulong *nr2)
|
||||
{
|
||||
@ -471,7 +494,7 @@ MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
|
||||
my_wildcmp_bin,
|
||||
my_strcasecmp_bin,
|
||||
my_instr_bin,
|
||||
my_hash_sort_bin,
|
||||
my_hash_sort_8bit_bin,
|
||||
my_propagate_simple
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user