• unknown's avatar
    Bug#20086: Can't get data from key partitioned tables with VARCHAR key · 4e138572
    unknown authored
    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.
    4e138572
sql_partition.cc 224 KB