From: mikael Date: April 5 2006 10:39am Subject: bk commit into 5.1 tree (mikron:1.2284) BUG#18198 List-Archive: http://lists.mysql.com/commits/4487 X-Bug: 18198 Message-Id: <20060405103928.5A379E1EA78@Mikael-Ronstr-ms-dator.local> Below is the list of changes that have just been committed into a local 5.1 repository of mikron. When mikron does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2284 06/04/05 12:39:06 mikron@stripped +3 -0 BUG#18198: Too much expressiveness in partition functions allowed First step sql/share/errmsg.txt 1.91 06/04/05 12:38:54 mikron@stripped +3 -0 Add a new error code for partition function not allowed sql/partition_info.cc 1.9 06/04/05 12:38:54 mikron@stripped +7 -0 Add a check whether the partition function is allowed by walking the partition function expression. sql/item.h 1.196 06/04/05 12:38:53 mikron@stripped +6 -0 Add function to check for partition function whether allowed or not. In this first step allow only a field on its own. Further steps will add a lot more possibilities. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: mikron # Host: mikael-ronstr-ms-dator.local # Root: /Users/mikron/bug18198 --- 1.195/sql/item.h 2006-04-04 13:14:56 +02:00 +++ 1.196/sql/item.h 2006-04-05 12:38:53 +02:00 @@ -744,6 +744,11 @@ virtual bool find_item_in_field_list_processor(byte *arg) { return 0; } virtual bool change_context_processor(byte *context) { return 0; } virtual bool reset_query_id_processor(byte *query_id) { return 0; } + virtual bool check_partition_func_processor(byte *bool_arg) + { + *(bool *)bool_arg= FALSE; + return 0; + } virtual Item *equal_fields_propagator(byte * arg) { return this; } virtual Item *set_no_const_sub(byte *arg) { return this; } @@ -1202,6 +1207,7 @@ result_field->query_id= field->query_id; return 0; } + bool check_partition_func_processor(byte *bool_arg) { return 0; } void cleanup(); Item_equal *find_item_equal(COND_EQUAL *cond_equal); Item *equal_fields_propagator(byte *arg); --- 1.90/sql/share/errmsg.txt 2006-03-20 21:41:16 +01:00 +++ 1.91/sql/share/errmsg.txt 2006-04-05 12:38:54 +02:00 @@ -5826,3 +5826,6 @@ eng "The NDB cluster engine does not support changing the binlog format on the fly yet" ER_PARTITION_NO_TEMPORARY eng "Cannot create temporary table with partitions" +ER_PARTITION_FUNCTION_NOT_ALLOWED + eng "This partition function is not allowed" + swe "Denna partitioneringsfunktion är inte tillåten" --- 1.8/sql/partition_info.cc 2006-03-31 19:39:35 +02:00 +++ 1.9/sql/partition_info.cc 2006-04-05 12:38:54 +02:00 @@ -655,8 +655,15 @@ uint i, tot_partitions; bool result= TRUE; char *same_name; + bool part_expression_ok= TRUE; DBUG_ENTER("partition_info::check_partition_info"); + if (part_expr->walk(Item::check_partition_func_processor, + (byte*)&part_expression_ok)) + { + my_error(ER_PARTITION_FUNC_NOT_ALLOWED, MYF(0)); + goto end; + } if (unlikely(!is_sub_partitioned() && !(use_default_subpartitions && use_default_no_subpartitions))) {