mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Bug# 15968 - Partitions: crash when insert with f1 = -1 into partition by hash(f1)
fixed mysql-test/r/partition_hash.result: results for newly added test. mysql-test/t/partition_hash.test: test case for inserting a value into a hash that would generate a negative value sql/sql_partition.cc: fields that generate a negative value would also generate a negative part_id which doesn't index into the m_file array to well.
This commit is contained in:
@@ -2327,7 +2327,8 @@ static uint32 get_part_id_hash(uint no_parts,
|
||||
Item *part_expr)
|
||||
{
|
||||
DBUG_ENTER("get_part_id_hash");
|
||||
DBUG_RETURN((uint32)(part_expr->val_int() % no_parts));
|
||||
longlong int_hash_id= part_expr->val_int() % no_parts;
|
||||
DBUG_RETURN(int_hash_id < 0 ? -int_hash_id : int_hash_id);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user