mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#20086: Can't get data from key partitioned tables with VARCHAR key
The problem appeared because the same values produced different hash during INSERT and SELECT for VARCHAR data type. Fix: VARCHAR required special treatment to avoid hashing of length bytes (leftmost one or two bytes) as well as trailing bytes beyond real length, which could contain garbage. Fix is done by introducing hash() - new method in the Field class. mysql-test/r/partition_innodb.result: Adding test case mysql-test/r/partition_pruning.result: Fixing test results (results differ due to changes in hash function) mysql-test/t/partition_innodb.test: Adding test case sql/field.cc: Adding generic hash() method, and a special method for VARCHAR. sql/field.h: Adding prototypes for new methods sql/key.cc: Mark columns for write before executinf of set_key_image(). Thanks for Mikael for suggesting this fix. sql/sql_partition.cc: Removing old hash code. Using new methid field->hash() instead.
This commit is contained in:
@ -31,7 +31,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where
|
||||
explain partitions select * from t2 where a=1 and b=1;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where
|
||||
create table t3 (
|
||||
a int
|
||||
)
|
||||
|
Reference in New Issue
Block a user