From 0461b482cb5151a9d52edc732ac6413e1dc3c000 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 May 2005 19:40:39 +0200 Subject: Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE After review version. Added a condition for MERGE tables. These do not have unique indexes. But every key could be a unique key on the underlying MyISAM table. So get the maximum key length for MERGE tables instead of the maximum unique key length. This is used for buffer allocation in write_record(). mysql-test/r/merge.result: Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE The test result. mysql-test/t/merge.test: Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE The test case does not in all cases show the problem without the bugfix. The improper memory allocation might get through undetected in many cases. sql/ha_myisammrg.h: Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE Set a table_flag for the MERGE engine telling that any index might be unique without being specified as such. sql/handler.h: Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE Added a new table_flag telling that any index might be unique without being specified as such. sql/sql_insert.cc: Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE Changed the freeing of the memory to be symmetric to its allocation (my_safe_alloc -> my_safe_afree). This is not directly related to the bug. sql/table.cc: Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE Added a condition for MERGE tables. These do not have unique indexes. But every key could be a unique key on the underlying MyISAM table. So get the maximum key length for MERGE tables instead of the maximum unique key length. This is used for buffer allocation in write_record(). --- sql/ha_myisammrg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/ha_myisammrg.h') diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h index 3bc9c11d4be..7348096b695 100644 --- a/sql/ha_myisammrg.h +++ b/sql/ha_myisammrg.h @@ -37,7 +37,7 @@ class ha_myisammrg: public handler { return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_READ_RND_SAME | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED | - HA_CAN_INSERT_DELAYED); + HA_CAN_INSERT_DELAYED | HA_ANY_INDEX_MAY_BE_UNIQUE); } ulong index_flags(uint inx, uint part, bool all_parts) const { -- cgit v1.2.1