diff options
author | unknown <reggie@linux.site> | 2006-01-06 18:52:49 -0600 |
---|---|---|
committer | unknown <reggie@linux.site> | 2006-01-06 18:52:49 -0600 |
commit | e262e74419002711770b09f64db9136f08eb3f15 (patch) | |
tree | 7cd64a787a8b6134713ecb64f4b907664b59bf20 /sql/sql_partition.cc | |
parent | 3c4c332fd0ce4f6ec06a1f3b0c98a25cac80a2f4 (diff) | |
download | mariadb-git-e262e74419002711770b09f64db9136f08eb3f15.tar.gz |
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.
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 5d071c5591c..f1b77cd0240 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -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); } |