From d868d032aa5f12ad95c1b9f9ffa54cbdda61cafc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Apr 2006 12:39:06 +0200 Subject: [PATCH 1/6] BUG#18198: Too much expressiveness in partition functions allowed First step sql/item.h: 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. sql/partition_info.cc: Add a check whether the partition function is allowed by walking the partition function expression. sql/share/errmsg.txt: Add a new error code for partition function not allowed --- sql/item.h | 6 ++++++ sql/partition_info.cc | 7 +++++++ sql/share/errmsg.txt | 3 +++ 3 files changed, 16 insertions(+) diff --git a/sql/item.h b/sql/item.h index 6c7a0976df1..9c979eb4acd 100644 --- a/sql/item.h +++ b/sql/item.h @@ -744,6 +744,11 @@ public: 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 @@ public: 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); diff --git a/sql/partition_info.cc b/sql/partition_info.cc index ad0aa053ae2..9c7999b136b 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -655,8 +655,15 @@ bool partition_info::check_partition_info(handlerton **eng_type, 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))) { diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index e8766b3d882..01202bb5b71 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5826,3 +5826,6 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT 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" From 32591e6959f5176ed64b7ace6e857fb20ee9151a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Apr 2006 12:49:38 +0200 Subject: [PATCH 2/6] BUG#18198: Too much expressiveness in partition function allowed Fixed the error check sql/partition_info.cc: Fixed the error check --- sql/partition_info.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 9c7999b136b..c671164578a 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -658,8 +658,13 @@ bool partition_info::check_partition_info(handlerton **eng_type, 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)) + if (part_type != HASH_PARTITION || !list_of_part_fields) + part_expr->walk(Item::check_partition_func_processor, + (byte*)&part_expression_ok); + if (is_sub_partitioned() && !list_of_subpart_fields) + subpart_expr->walk(Item::check_partition_func_processor, + (byte*)&part_expression_ok); + if (!part_expression_ok) { my_error(ER_PARTITION_FUNC_NOT_ALLOWED, MYF(0)); goto end; From 09250cc6b74b6de006ec86606e4a345d0451fa92 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 8 Apr 2006 18:10:20 -0400 Subject: [PATCH 3/6] BUG#18198: Errors due to too much allowed in partition functions Added functions to enable/disable allowed/disallowed partition functions sql/item.h: Added functions to enable/disable allowed/disallowed partition functions sql/item_cmpfunc.h: Added functions to enable/disable allowed/disallowed partition functions sql/item_func.h: Added functions to enable/disable allowed/disallowed partition functions sql/item_strfunc.h: Added functions to enable/disable allowed/disallowed partition functions sql/item_timefunc.h: Added functions to enable/disable allowed/disallowed partition functions sql/item_xmlfunc.h: Added functions to enable/disable allowed/disallowed partition functions sql/partition_info.cc: Added functions to enable/disable allowed/disallowed partition functions sql/share/errmsg.txt: Added new error message --- sql/item.h | 38 ++++++++++++++++++++++++++++++++++---- sql/item_cmpfunc.h | 15 +++++++++++++++ sql/item_func.h | 32 +++++++++++++++++++++++++++++++- sql/item_strfunc.h | 24 ++++++++++++++++++++++++ sql/item_timefunc.h | 30 ++++++++++++++++++++++++++++++ sql/item_xmlfunc.h | 1 + sql/partition_info.cc | 10 +++++----- sql/share/errmsg.txt | 2 +- 8 files changed, 141 insertions(+), 11 deletions(-) diff --git a/sql/item.h b/sql/item.h index 9c979eb4acd..d5cddaa7177 100644 --- a/sql/item.h +++ b/sql/item.h @@ -744,11 +744,22 @@ public: 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; } + /* + check_partition_func_processor is used to check if a partition function + uses an allowed function. The default is that an item is not allowed + in a partition function. However all mathematical functions, string + manipulation functions, date functions are allowed. Allowed functions + can never depend on server version, they cannot depend on anything + related to the environment. They can also only depend on a set of + fields in the table itself. They cannot depend on other tables and + cannot contain any queries and cannot contain udf's or similar. + If a new Item class is defined and it inherits from a class that is + allowed in a partition function then it is very important to consider + whether this should be inherited to the new class. If not the function + below should be defined in the new Item class. + */ virtual bool check_partition_func_processor(byte *bool_arg) - { - *(bool *)bool_arg= FALSE; - return 0; - } + { *(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; } @@ -1020,6 +1031,7 @@ public: Item::maybe_null= TRUE; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0; } bool fix_fields(THD *, Item **); enum Type type() const; @@ -1066,6 +1078,7 @@ public: Item_num() {} /* Remove gcc warning */ virtual Item_num *neg()= 0; Item *safe_charset_converter(CHARSET_INFO *tocs); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #define NO_CACHED_FIELD_INDEX ((uint)(-1)) @@ -1251,6 +1264,7 @@ public: bool is_null() { return 1; } void print(String *str) { str->append(STRING_WITH_LEN("NULL")); } Item *safe_charset_converter(CHARSET_INFO *tocs); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_null_result :public Item_null @@ -1263,6 +1277,8 @@ public: { save_in_field(result_field, no_conversions); } + virtual bool check_partition_func_processor(byte *bool_arg) + { *(bool *)bool_arg= FALSE; return 0; } }; /* Item represents one placeholder ('?') of prepared statement */ @@ -1446,6 +1462,8 @@ public: {} Item *safe_charset_converter(CHARSET_INFO *tocs); void print(String *str) { str->append(func_name); } + virtual bool check_partition_func_processor(byte *bool_arg) + { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1564,6 +1582,8 @@ public: {} void print(String *str) { str->append(func_name); } Item *safe_charset_converter(CHARSET_INFO *tocs); + virtual bool check_partition_func_processor(byte *bool_arg) + { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1641,6 +1661,7 @@ public: void print(String *str); // to prevent drop fixed flag (no need parent cleanup call) void cleanup() {} + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -1655,6 +1676,8 @@ public: {} Item *safe_charset_converter(CHARSET_INFO *tocs); void print(String *str) { str->append(func_name); } + virtual bool check_partition_func_processor(byte *bool_arg) + { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1667,6 +1690,8 @@ public: &my_charset_bin) { max_length=19;} enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } + virtual bool check_partition_func_processor(byte *bool_arg) + { *(bool *)bool_arg= FALSE; return 0; } }; class Item_empty_string :public Item_string @@ -1689,6 +1714,8 @@ public: unsigned_flag=1; } enum_field_types field_type() const { return int_field_type; } + virtual bool check_partition_func_processor(byte *bool_arg) + { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1712,6 +1739,7 @@ public: void cleanup() {} bool eq(const Item *item, bool binary_cmp) const; virtual Item *safe_charset_converter(CHARSET_INFO *tocs); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -1949,6 +1977,8 @@ public: } Item *new_item(); virtual Item *real_item() { return ref; } + virtual bool check_partition_func_processor(byte *bool_arg) + { *(bool *)bool_arg= FALSE; return 0; } }; #ifdef MYSQL_SERVER diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 67f0a5f5e2e..0472fe17975 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -239,6 +239,7 @@ public: } Item *neg_transformer(THD *thd); virtual Item *negated_item(); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_not :public Item_bool_func @@ -249,6 +250,7 @@ public: enum Functype functype() const { return NOT_FUNC; } const char *func_name() const { return "not"; } Item *neg_transformer(THD *thd); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_maxmin_subselect; @@ -463,6 +465,7 @@ public: bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } uint decimal_precision() const { return 1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -474,6 +477,7 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "strcmp"; } void print(String *str) { Item_func::print(str); } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -536,6 +540,7 @@ public: const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); uint decimal_precision() const; + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -576,6 +581,7 @@ public: void print(String *str) { Item_func::print(str); } table_map not_null_tables() const { return 0; } bool is_null(); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -618,6 +624,7 @@ public: void print(String *str); Item *find_item(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -897,6 +904,7 @@ class Item_func_in :public Item_func_opt_neg bool nulls_in_row(); bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; /* Functions used by where clause */ @@ -938,6 +946,7 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NULL; } Item *neg_transformer(THD *thd); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; /* Functions used by HAVING for rewriting IN subquery */ @@ -959,6 +968,8 @@ public: */ table_map used_tables() const { return used_tables_cache | RAND_TABLE_BIT; } + virtual bool check_partition_func_processor(byte *bool_arg) + { *(bool *)bool_arg= FALSE; return 0; } }; @@ -981,6 +992,7 @@ public: void print(String *str); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } void top_level_item() { abort_on_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -1019,6 +1031,7 @@ public: const char *func_name() const { return "like"; } bool fix_fields(THD *thd, Item **ref); void cleanup(); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #ifdef USE_REGEX @@ -1041,6 +1054,7 @@ public: const char *func_name() const { return "regexp"; } void print(String *str) { print_op(str); } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #else @@ -1097,6 +1111,7 @@ public: Item *transform(Item_transformer transformer, byte *arg); void traverse_cond(Cond_traverser, void *arg, traverse_order order); void neg_arguments(THD *thd); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; diff --git a/sql/item_func.h b/sql/item_func.h index ccbbbab1df4..58ac28aeb9d 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -247,6 +247,7 @@ public: void fix_num_length_and_dec(); void find_num_type(); String *str_op(String *str) { DBUG_ASSERT(0); return 0; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -259,6 +260,7 @@ class Item_num_op :public Item_func_numhybrid void print(String *str) { print_op(str); } void find_num_type(); String *str_op(String *str) { DBUG_ASSERT(0); return 0; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -296,7 +298,7 @@ public: { max_length=args[0]->max_length; unsigned_flag=0; } void print(String *str); uint decimal_precision() const { return args[0]->decimal_precision(); } - + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -330,6 +332,7 @@ public: void fix_length_and_dec() {}; const char *func_name() const { return "decimal_typecast"; } void print(String *); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -398,6 +401,7 @@ public: const char *func_name() const { return "DIV"; } void fix_length_and_dec(); void print(String *str) { print_op(str); } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -470,6 +474,7 @@ public: Item_func_exp(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "exp"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -479,6 +484,7 @@ public: Item_func_ln(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "ln"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -489,6 +495,7 @@ public: Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {} double val_real(); const char *func_name() const { return "log"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -498,6 +505,7 @@ public: Item_func_log2(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "log2"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -507,6 +515,7 @@ public: Item_func_log10(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "log10"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -516,6 +525,7 @@ public: Item_func_sqrt(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "sqrt"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -525,6 +535,7 @@ public: Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {} double val_real(); const char *func_name() const { return "pow"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -534,6 +545,7 @@ public: Item_func_acos(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "acos"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_asin :public Item_dec_func @@ -542,6 +554,7 @@ public: Item_func_asin(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "asin"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_atan :public Item_dec_func @@ -551,6 +564,7 @@ public: Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {} double val_real(); const char *func_name() const { return "atan"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_cos :public Item_dec_func @@ -559,6 +573,7 @@ public: Item_func_cos(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "cos"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_sin :public Item_dec_func @@ -567,6 +582,7 @@ public: Item_func_sin(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "sin"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_tan :public Item_dec_func @@ -575,6 +591,7 @@ public: Item_func_tan(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "tan"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_integer :public Item_int_func @@ -651,6 +668,7 @@ public: Item_func_sign(Item *a) :Item_int_func(a) {} const char *func_name() const { return "sign"; } longlong val_int(); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -665,6 +683,7 @@ public: const char *func_name() const { return name; } void fix_length_and_dec() { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -682,6 +701,7 @@ public: my_decimal *val_decimal(my_decimal *); void fix_length_and_dec(); enum Item_result result_type () const { return cmp_type; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_min :public Item_func_min_max @@ -707,6 +727,7 @@ public: longlong val_int(); const char *func_name() const { return "length"; } void fix_length_and_dec() { max_length=10; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_bit_length :public Item_func_length @@ -726,6 +747,7 @@ public: longlong val_int(); const char *func_name() const { return "char_length"; } void fix_length_and_dec() { max_length=10; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_coercibility :public Item_int_func @@ -736,6 +758,7 @@ public: const char *func_name() const { return "coercibility"; } void fix_length_and_dec() { max_length=10; maybe_null= 0; } table_map not_null_tables() const { return 0; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_locate :public Item_int_func @@ -749,6 +772,7 @@ public: longlong val_int(); void fix_length_and_dec(); void print(String *str); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -773,6 +797,7 @@ public: longlong val_int(); const char *func_name() const { return "ascii"; } void fix_length_and_dec() { max_length=3; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_ord :public Item_int_func @@ -782,6 +807,7 @@ public: Item_func_ord(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "ord"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_find_in_set :public Item_int_func @@ -795,6 +821,7 @@ public: longlong val_int(); const char *func_name() const { return "find_in_set"; } void fix_length_and_dec(); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; /* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */ @@ -806,6 +833,7 @@ public: Item_func_bit(Item *a) :Item_int_func(a) {} void fix_length_and_dec() { unsigned_flag= 1; } void print(String *str) { print_op(str); } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_bit_or :public Item_func_bit @@ -831,6 +859,7 @@ public: longlong val_int(); const char *func_name() const { return "bit_count"; } void fix_length_and_dec() { max_length=2; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_shift_left :public Item_func_bit @@ -1257,6 +1286,7 @@ public: longlong val_int(); const char *func_name() const { return "inet_aton"; } void fix_length_and_dec() { decimals = 0; max_length = 21; maybe_null=1;} + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 6a95a9e5d1f..5e4fe49e281 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -46,6 +46,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "md5"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -56,6 +57,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "sha"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_aes_encrypt :public Item_str_func @@ -86,6 +88,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "concat"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_concat_ws :public Item_str_func @@ -106,6 +109,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "reverse"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -143,6 +147,7 @@ protected: public: Item_str_conv(Item *item) :Item_str_func(item) {} String *val_str(String *); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -206,6 +211,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "substr"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -217,6 +223,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "substring_index"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -231,6 +238,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "trim"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -410,6 +418,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "soundex"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -517,6 +526,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "rpad"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -529,6 +539,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "lpad"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -543,6 +554,7 @@ public: collation.set(default_charset()); decimals=0; max_length=64; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -559,6 +571,7 @@ public: decimals=0; max_length=args[0]->max_length*2*collation.collation->mbmaxlen; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_unhex :public Item_str_func @@ -574,6 +587,7 @@ public: decimals=0; max_length=(1+args[0]->max_length)/2; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -597,6 +611,7 @@ public: } void print(String *str); const char *func_name() const { return "cast_as_binary"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -636,6 +651,7 @@ public: String* val_str(String* str); const char *func_name() const { return "inet_ntoa"; } void fix_length_and_dec() { decimals = 0; max_length=3*8+7; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_quote :public Item_str_func @@ -650,6 +666,7 @@ public: collation.set(args[0]->collation); max_length= args[0]->max_length * 2 + 2; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_conv_charset :public Item_str_func @@ -692,6 +709,7 @@ public: void fix_length_and_dec(); const char *func_name() const { return "convert"; } void print(String *str); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_set_collation :public Item_str_func @@ -724,6 +742,7 @@ public: maybe_null= 0; }; table_map not_null_tables() const { return 0; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_collation :public Item_str_func @@ -739,6 +758,7 @@ public: maybe_null= 0; }; table_map not_null_tables() const { return 0; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_crc32 :public Item_int_func @@ -749,6 +769,7 @@ public: const char *func_name() const { return "crc32"; } void fix_length_and_dec() { max_length=10; } longlong val_int(); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_uncompressed_length : public Item_int_func @@ -759,6 +780,7 @@ public: const char *func_name() const{return "uncompressed_length";} void fix_length_and_dec() { max_length=10; } longlong val_int(); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #ifdef HAVE_COMPRESS @@ -775,6 +797,7 @@ public: void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;} const char *func_name() const{return "compress";} String *val_str(String *) ZLIB_DEPENDED_FUNCTION + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_uncompress: public Item_str_func @@ -785,6 +808,7 @@ public: void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;} const char *func_name() const{return "uncompress";} String *val_str(String *) ZLIB_DEPENDED_FUNCTION + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #define UUID_LENGTH (8+1+4+1+4+1+4+1+12) diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index fd2f3945fca..ffe049873fc 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -39,6 +39,7 @@ public: { max_length=6*MY_CHARSET_BIN_MB_MAXLEN; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -53,6 +54,7 @@ public: decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -69,6 +71,7 @@ public: maybe_null=1; } enum_monotonicity_info get_monotonicity_info() const; + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -84,6 +87,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -108,6 +112,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -140,6 +145,7 @@ public: max_length=3*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -155,6 +161,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -170,6 +177,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -185,6 +193,7 @@ public: max_length=1*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -200,6 +209,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -215,6 +225,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_yearweek :public Item_int_func @@ -229,6 +240,7 @@ public: max_length=6*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -245,6 +257,7 @@ public: max_length=4*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -274,6 +287,7 @@ public: max_length=1*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_dayname :public Item_func_weekday @@ -306,6 +320,7 @@ public: decimals=0; max_length=10*MY_CHARSET_BIN_MB_MAXLEN; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -320,6 +335,7 @@ public: decimals=0; max_length=10*MY_CHARSET_BIN_MB_MAXLEN; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -526,6 +542,7 @@ public: Item_func_from_days(Item *a) :Item_date(a) {} const char *func_name() const { return "from_days"; } bool get_date(TIME *res, uint fuzzy_date); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -543,6 +560,7 @@ public: void fix_length_and_dec(); uint format_length(const String *format); bool eq(const Item *item, bool binary_cmp) const; + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -561,6 +579,7 @@ class Item_func_from_unixtime :public Item_date_func const char *func_name() const { return "from_unixtime"; } void fix_length_and_dec(); bool get_date(TIME *res, uint fuzzy_date); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -627,6 +646,7 @@ public: { return tmp_table_field_from_field_type(table, 0); } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -648,6 +668,7 @@ public: longlong val_int(); bool get_date(TIME *res, uint fuzzy_date); void print(String *str); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -665,6 +686,7 @@ class Item_extract :public Item_int_func void fix_length_and_dec(); bool eq(const Item *item, bool binary_cmp) const; void print(String *str); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -701,6 +723,7 @@ public: max_length=args[0]->max_length; maybe_null= 1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -720,6 +743,7 @@ public: String *val_str(String *a); void fix_length_and_dec(); void print(String *str); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -791,6 +815,7 @@ public: { return tmp_table_field_from_field_type(table, 0); } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -813,6 +838,7 @@ public: } void print(String *str); const char *func_name() const { return "add_time"; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_timediff :public Item_str_func @@ -852,6 +878,7 @@ public: { return tmp_table_field_from_field_type(table, 0); } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_microsecond :public Item_int_func @@ -865,6 +892,7 @@ public: decimals=0; maybe_null=1; } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -882,6 +910,7 @@ public: maybe_null=1; } void print(String *str); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -928,6 +957,7 @@ public: { return tmp_table_field_from_field_type(table, 1); } + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h index bc47e9c5bb1..53302283296 100644 --- a/sql/item_xmlfunc.h +++ b/sql/item_xmlfunc.h @@ -42,6 +42,7 @@ public: Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {} const char *func_name() const { return "extractvalue"; } String *val_str(String *); + virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} }; diff --git a/sql/partition_info.cc b/sql/partition_info.cc index c671164578a..c957efa71fb 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -659,14 +659,14 @@ bool partition_info::check_partition_info(handlerton **eng_type, DBUG_ENTER("partition_info::check_partition_info"); if (part_type != HASH_PARTITION || !list_of_part_fields) - part_expr->walk(Item::check_partition_func_processor, - (byte*)&part_expression_ok); + part_expr->walk(&Item::check_partition_func_processor, + (byte*)(&part_expression_ok)); if (is_sub_partitioned() && !list_of_subpart_fields) - subpart_expr->walk(Item::check_partition_func_processor, - (byte*)&part_expression_ok); + subpart_expr->walk(&Item::check_partition_func_processor, + (byte*)(&part_expression_ok)); if (!part_expression_ok) { - my_error(ER_PARTITION_FUNC_NOT_ALLOWED, MYF(0)); + my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0)); goto end; } if (unlikely(!is_sub_partitioned() && diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 01202bb5b71..da2e0f4e275 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5826,6 +5826,6 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT 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 +ER_PARTITION_FUNCTION_IS_NOT_ALLOWED eng "This partition function is not allowed" swe "Denna partitioneringsfunktion är inte tillåten" From 0146929f09969ce4c08556b756273ec4eb508ed7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 May 2006 14:51:46 -0400 Subject: [PATCH 4/6] BUG#17310: Archive error for drop database mysql-test/r/partition.result: Added new test case mysql-test/t/partition.test: Added new test case storage/archive/ha_archive.cc: Moved some code to avoid that ha_archive::create leaves files after error in create There are still cases where this occurs but now only on file creation errors. --- mysql-test/r/partition.result | 12 ++++++++++++ mysql-test/t/partition.test | 17 +++++++++++++++++ storage/archive/ha_archive.cc | 17 +++++++++-------- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 3be9f3edee2..2fb7b6942de 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -936,4 +936,16 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize note The storage engine for the table doesn't support optimize drop table t1; +create database db99; +use db99; +create table t1 (a int not null) +engine=archive +partition by list (a) +(partition p0 values in (1), partition p1 values in (2)); +insert into t1 values (1), (2); +create index inx on t1 (a); +alter table t1 add partition (partition p2 values in (3)); +alter table t1 drop partition p2; +use test; +drop database db99; End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index a24124d3fb5..f7676ca471a 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1077,4 +1077,21 @@ OPTIMIZE TABLE t1; drop table t1; +# +# Bug 17310 Partitions: Bugs with archived partitioned tables +# +create database db99; +use db99; +create table t1 (a int not null) +engine=archive +partition by list (a) +(partition p0 values in (1), partition p1 values in (2)); +insert into t1 values (1), (2); +--error 0, 1005 +create index inx on t1 (a); +alter table t1 add partition (partition p2 values in (3)); +alter table t1 drop partition p2; +use test; +drop database db99; + --echo End of 5.1 tests diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index f3f20f6b103..03710b7c380 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -701,14 +701,6 @@ int ha_archive::create(const char *name, TABLE *table_arg, create_info->auto_increment_value -1 : (ulonglong) 0); - if ((create_file= my_create(fn_format(name_buff,name,"",ARM, - MY_REPLACE_EXT|MY_UNPACK_FILENAME),0, - O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) - { - error= my_errno; - goto error; - } - for (uint key= 0; key < table_arg->s->keys; key++) { KEY *pos= table_arg->key_info+key; @@ -722,11 +714,20 @@ int ha_archive::create(const char *name, TABLE *table_arg, if (!(field->flags & AUTO_INCREMENT_FLAG)) { error= -1; + DBUG_PRINT("info", ("Index error in creating archive table")); goto error; } } } + if ((create_file= my_create(fn_format(name_buff,name,"",ARM, + MY_REPLACE_EXT|MY_UNPACK_FILENAME),0, + O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) + { + error= my_errno; + goto error; + } + write_meta_file(create_file, 0, auto_increment_value, 0, (char *)create_info->data_file_name, FALSE); From 50ddc348d3a3ce85724c09907c2a0dee1507daaf Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 31 May 2006 09:33:10 -0400 Subject: [PATCH 5/6] BUG#20161: LINEAR keyword on subpartitions not displayed in information schema for partitions and in SHOW CREATE TABLE mysql-test/r/information_schema_part.result: Added new test cases mysql-test/t/information_schema_part.test: Added new test cases sql/sql_partition.cc: Added missing check for LINEAR keyword on subpartitions sql/sql_show.cc: Added missing check for LINEAR keyword on subpartitions Small remove of duplicate code --- mysql-test/r/information_schema_part.result | 29 +++++++++++++++++++++ mysql-test/t/information_schema_part.test | 22 ++++++++++++++++ sql/sql_partition.cc | 2 ++ sql/sql_show.cc | 21 ++++++++------- 4 files changed, 65 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/information_schema_part.result b/mysql-test/r/information_schema_part.result index cf49abf888a..e1bc6ef8700 100644 --- a/mysql-test/r/information_schema_part.result +++ b/mysql-test/r/information_schema_part.result @@ -111,3 +111,32 @@ NULL test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 NULL test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default drop table t1; +create table t1 (a int) +PARTITION BY RANGE (a) +SUBPARTITION BY LINEAR HASH (a) +(PARTITION p0 VALUES LESS THAN (10)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY LINEAR HASH (a) (PARTITION p0 VALUES LESS THAN (10) ) +select SUBPARTITION_METHOD FROM information_schema.partitions WHERE +table_schema="test" AND table_name="t1"; +SUBPARTITION_METHOD +LINEAR HASH +drop table t1; +create table t1 (a int) +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN +(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, +32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53) ENGINE = MyISAM) +SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE +table_schema = "test" AND table_name = "t1"; +PARTITION_DESCRIPTION +10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53 +drop table t1; diff --git a/mysql-test/t/information_schema_part.test b/mysql-test/t/information_schema_part.test index 163b04248b8..4cbf21ca1d3 100644 --- a/mysql-test/t/information_schema_part.test +++ b/mysql-test/t/information_schema_part.test @@ -99,3 +99,25 @@ select * from information_schema.partitions where table_schema="test" and table_name="t1"; drop table t1; +# +# Bug 20161 Partitions: SUBPARTITION METHOD doesn't show LINEAR keyword +# +create table t1 (a int) +PARTITION BY RANGE (a) +SUBPARTITION BY LINEAR HASH (a) +(PARTITION p0 VALUES LESS THAN (10)); + +SHOW CREATE TABLE t1; +select SUBPARTITION_METHOD FROM information_schema.partitions WHERE +table_schema="test" AND table_name="t1"; +drop table t1; + +create table t1 (a int) +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN +(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53)); +SHOW CREATE TABLE t1; +SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE +table_schema = "test" AND table_name = "t1"; +drop table t1; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index e946e972968..f6346821be2 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1843,6 +1843,8 @@ char *generate_partition_syntax(partition_info *part_info, { err+= add_subpartition_by(fptr); /* Must be hash partitioning for subpartitioning */ + if (part_info->linear_hash_ind) + err+= add_string(fptr, partition_keywords[PKW_LINEAR].str); if (part_info->list_of_subpart_fields) err+= add_key_partition(fptr, part_info->subpart_field_list); else diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ac1825d7c84..c2d4904eb1b 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3911,24 +3911,28 @@ static int get_schema_partitions_record(THD *thd, struct st_table_list *tables, { table->field[9]->store(part_info->part_func_string, part_info->part_func_len, cs); - table->field[9]->set_notnull(); } else if (part_info->list_of_part_fields) { collect_partition_expr(part_info->part_field_list, &tmp_str); table->field[9]->store(tmp_str.ptr(), tmp_str.length(), cs); - table->field[9]->set_notnull(); } + table->field[9]->set_notnull(); if (part_info->is_sub_partitioned()) { /* Subpartition method */ + tmp_res.length(0); + if (part_info->linear_hash_ind) + tmp_res.append(partition_keywords[PKW_LINEAR].str, + partition_keywords[PKW_LINEAR].length); if (part_info->list_of_subpart_fields) - table->field[8]->store(partition_keywords[PKW_KEY].str, - partition_keywords[PKW_KEY].length, cs); + tmp_res.append(partition_keywords[PKW_KEY].str, + partition_keywords[PKW_KEY].length); else - table->field[8]->store(partition_keywords[PKW_HASH].str, - partition_keywords[PKW_HASH].length, cs); + tmp_res.append(partition_keywords[PKW_HASH].str, + partition_keywords[PKW_HASH].length); + table->field[8]->store(tmp_res.ptr(), tmp_res.length(), cs); table->field[8]->set_notnull(); /* Subpartition expression */ @@ -3936,14 +3940,13 @@ static int get_schema_partitions_record(THD *thd, struct st_table_list *tables, { table->field[10]->store(part_info->subpart_func_string, part_info->subpart_func_len, cs); - table->field[10]->set_notnull(); } else if (part_info->list_of_subpart_fields) { collect_partition_expr(part_info->subpart_field_list, &tmp_str); table->field[10]->store(tmp_str.ptr(), tmp_str.length(), cs); - table->field[10]->set_notnull(); } + table->field[10]->set_notnull(); } while ((part_elem= part_it++)) @@ -5241,7 +5244,7 @@ ST_FIELD_INFO partitions_fields_info[]= {"PARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 1, 0}, {"SUBPARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 1, 0}, {"PARTITION_METHOD", 12, MYSQL_TYPE_STRING, 0, 1, 0}, - {"SUBPARTITION_METHOD", 5, MYSQL_TYPE_STRING, 0, 1, 0}, + {"SUBPARTITION_METHOD", 12, MYSQL_TYPE_STRING, 0, 1, 0}, {"PARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0}, {"SUBPARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0}, {"PARTITION_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0}, From a706b2a33a8450f8ce8b3da728d39eb72271d0a3 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 31 May 2006 13:32:14 -0400 Subject: [PATCH 6/6] BUG#18198: Many strange partition functions were allowed, now only strictly allowed functions are ok mysql-test/r/partition_error.result: New test cases mysql-test/t/partition_error.test: New test cases sql/item.h: Added method check_partition_func_processor for check if item tree is valid sql/item_cmpfunc.h: Added method check_partition_func_processor for check if item tree is valid sql/item_func.h: Added method check_partition_func_processor for check if item tree is valid sql/item_strfunc.h: Added method check_partition_func_processor for check if item tree is valid sql/item_timefunc.h: Added method check_partition_func_processor for check if item tree is valid sql/item_xmlfunc.h: Added method check_partition_func_processor for check if item tree is valid --- mysql-test/r/partition_error.result | 23 +++++++++++ mysql-test/t/partition_error.test | 28 +++++++++++++ sql/item.h | 31 +++++++++------ sql/item_cmpfunc.h | 28 ++++++------- sql/item_func.h | 62 ++++++++++++++--------------- sql/item_strfunc.h | 48 +++++++++++----------- sql/item_timefunc.h | 60 ++++++++++++++-------------- sql/item_xmlfunc.h | 2 +- 8 files changed, 170 insertions(+), 112 deletions(-) diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 1a0b1dd9b3a..a7ca3d9b2fa 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -554,3 +554,26 @@ PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5)); insert into t1 values (10); ERROR HY000: Table has no partition for value 10 drop table t1; +create table t1 (v varchar(12)) +partition by range (ascii(v)) +(partition p0 values less than (10)); +drop table t1; +create table t1 (a int) +partition by hash (rand(a)); +ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2 +create table t1 (a int) +partition by hash(CURTIME() + a); +ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2 +create table t1 (a int) +partition by hash (NOW()+a); +ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2 +create table t1 (a int) +partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00'))); +ERROR HY000: This partition function is not allowed +create table t1 (a int) +partition by range (a + (select count(*) from t1)) +(partition p1 values less than (1)); +ERROR HY000: This partition function is not allowed +create table t1 (a char(10)) +partition by hash (extractvalue(a,'a')); +ERROR HY000: The PARTITION function returns the wrong type diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index 03a2ab41807..659f0b8cef4 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -747,3 +747,31 @@ CREATE TABLE t1(a int) --error ER_NO_PARTITION_FOR_GIVEN_VALUE insert into t1 values (10); drop table t1; + +# +# Bug 18198 Partitions: Verify that erroneus partition functions doesn't work +# +create table t1 (v varchar(12)) +partition by range (ascii(v)) +(partition p0 values less than (10)); +drop table t1; + +-- error 1064 +create table t1 (a int) +partition by hash (rand(a)); +-- error 1064 +create table t1 (a int) +partition by hash(CURTIME() + a); +-- error 1064 +create table t1 (a int) +partition by hash (NOW()+a); +-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int) +partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00'))); +-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int) +partition by range (a + (select count(*) from t1)) +(partition p1 values less than (1)); +-- error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +create table t1 (a char(10)) +partition by hash (extractvalue(a,'a')); diff --git a/sql/item.h b/sql/item.h index d5cddaa7177..ea68bfa9a17 100644 --- a/sql/item.h +++ b/sql/item.h @@ -745,6 +745,13 @@ public: virtual bool change_context_processor(byte *context) { return 0; } virtual bool reset_query_id_processor(byte *query_id) { return 0; } /* + Check if a partition function is allowed + SYNOPSIS + check_partition_func_processor() + bool_arg Return argument + RETURN VALUE + 0 + DESCRIPTION check_partition_func_processor is used to check if a partition function uses an allowed function. The default is that an item is not allowed in a partition function. However all mathematical functions, string @@ -1031,7 +1038,7 @@ public: Item::maybe_null= TRUE; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0; } + bool check_partition_func_processor(byte *bool_arg) { return 0; } bool fix_fields(THD *, Item **); enum Type type() const; @@ -1078,7 +1085,7 @@ public: Item_num() {} /* Remove gcc warning */ virtual Item_num *neg()= 0; Item *safe_charset_converter(CHARSET_INFO *tocs); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #define NO_CACHED_FIELD_INDEX ((uint)(-1)) @@ -1264,7 +1271,7 @@ public: bool is_null() { return 1; } void print(String *str) { str->append(STRING_WITH_LEN("NULL")); } Item *safe_charset_converter(CHARSET_INFO *tocs); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_null_result :public Item_null @@ -1277,7 +1284,7 @@ public: { save_in_field(result_field, no_conversions); } - virtual bool check_partition_func_processor(byte *bool_arg) + bool check_partition_func_processor(byte *bool_arg) { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1462,7 +1469,7 @@ public: {} Item *safe_charset_converter(CHARSET_INFO *tocs); void print(String *str) { str->append(func_name); } - virtual bool check_partition_func_processor(byte *bool_arg) + bool check_partition_func_processor(byte *bool_arg) { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1582,7 +1589,7 @@ public: {} void print(String *str) { str->append(func_name); } Item *safe_charset_converter(CHARSET_INFO *tocs); - virtual bool check_partition_func_processor(byte *bool_arg) + bool check_partition_func_processor(byte *bool_arg) { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1661,7 +1668,7 @@ public: void print(String *str); // to prevent drop fixed flag (no need parent cleanup call) void cleanup() {} - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -1676,7 +1683,7 @@ public: {} Item *safe_charset_converter(CHARSET_INFO *tocs); void print(String *str) { str->append(func_name); } - virtual bool check_partition_func_processor(byte *bool_arg) + bool check_partition_func_processor(byte *bool_arg) { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1690,7 +1697,7 @@ public: &my_charset_bin) { max_length=19;} enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } - virtual bool check_partition_func_processor(byte *bool_arg) + bool check_partition_func_processor(byte *bool_arg) { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1714,7 +1721,7 @@ public: unsigned_flag=1; } enum_field_types field_type() const { return int_field_type; } - virtual bool check_partition_func_processor(byte *bool_arg) + bool check_partition_func_processor(byte *bool_arg) { *(bool *)bool_arg= FALSE; return 0; } }; @@ -1739,7 +1746,7 @@ public: void cleanup() {} bool eq(const Item *item, bool binary_cmp) const; virtual Item *safe_charset_converter(CHARSET_INFO *tocs); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -1977,7 +1984,7 @@ public: } Item *new_item(); virtual Item *real_item() { return ref; } - virtual bool check_partition_func_processor(byte *bool_arg) + bool check_partition_func_processor(byte *bool_arg) { *(bool *)bool_arg= FALSE; return 0; } }; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 0472fe17975..1a289c05006 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -239,7 +239,7 @@ public: } Item *neg_transformer(THD *thd); virtual Item *negated_item(); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_not :public Item_bool_func @@ -250,7 +250,7 @@ public: enum Functype functype() const { return NOT_FUNC; } const char *func_name() const { return "not"; } Item *neg_transformer(THD *thd); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_maxmin_subselect; @@ -465,7 +465,7 @@ public: bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } uint decimal_precision() const { return 1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -477,7 +477,7 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "strcmp"; } void print(String *str) { Item_func::print(str); } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -540,7 +540,7 @@ public: const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); uint decimal_precision() const; - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -581,7 +581,7 @@ public: void print(String *str) { Item_func::print(str); } table_map not_null_tables() const { return 0; } bool is_null(); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -624,7 +624,7 @@ public: void print(String *str); Item *find_item(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -904,7 +904,7 @@ class Item_func_in :public Item_func_opt_neg bool nulls_in_row(); bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; /* Functions used by where clause */ @@ -946,7 +946,7 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NULL; } Item *neg_transformer(THD *thd); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; /* Functions used by HAVING for rewriting IN subquery */ @@ -968,7 +968,7 @@ public: */ table_map used_tables() const { return used_tables_cache | RAND_TABLE_BIT; } - virtual bool check_partition_func_processor(byte *bool_arg) + bool check_partition_func_processor(byte *bool_arg) { *(bool *)bool_arg= FALSE; return 0; } }; @@ -992,7 +992,7 @@ public: void print(String *str); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } void top_level_item() { abort_on_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -1031,7 +1031,7 @@ public: const char *func_name() const { return "like"; } bool fix_fields(THD *thd, Item **ref); void cleanup(); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #ifdef USE_REGEX @@ -1054,7 +1054,7 @@ public: const char *func_name() const { return "regexp"; } void print(String *str) { print_op(str); } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #else @@ -1111,7 +1111,7 @@ public: Item *transform(Item_transformer transformer, byte *arg); void traverse_cond(Cond_traverser, void *arg, traverse_order order); void neg_arguments(THD *thd); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; diff --git a/sql/item_func.h b/sql/item_func.h index 58ac28aeb9d..4d942bf8775 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -247,7 +247,7 @@ public: void fix_num_length_and_dec(); void find_num_type(); String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -260,7 +260,7 @@ class Item_num_op :public Item_func_numhybrid void print(String *str) { print_op(str); } void find_num_type(); String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -298,7 +298,7 @@ public: { max_length=args[0]->max_length; unsigned_flag=0; } void print(String *str); uint decimal_precision() const { return args[0]->decimal_precision(); } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -332,7 +332,7 @@ public: void fix_length_and_dec() {}; const char *func_name() const { return "decimal_typecast"; } void print(String *); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -401,7 +401,7 @@ public: const char *func_name() const { return "DIV"; } void fix_length_and_dec(); void print(String *str) { print_op(str); } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -474,7 +474,7 @@ public: Item_func_exp(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "exp"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -484,7 +484,7 @@ public: Item_func_ln(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "ln"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -495,7 +495,7 @@ public: Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {} double val_real(); const char *func_name() const { return "log"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -505,7 +505,7 @@ public: Item_func_log2(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "log2"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -515,7 +515,7 @@ public: Item_func_log10(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "log10"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -525,7 +525,7 @@ public: Item_func_sqrt(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "sqrt"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -535,7 +535,7 @@ public: Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {} double val_real(); const char *func_name() const { return "pow"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -545,7 +545,7 @@ public: Item_func_acos(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "acos"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_asin :public Item_dec_func @@ -554,7 +554,7 @@ public: Item_func_asin(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "asin"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_atan :public Item_dec_func @@ -564,7 +564,7 @@ public: Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {} double val_real(); const char *func_name() const { return "atan"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_cos :public Item_dec_func @@ -573,7 +573,7 @@ public: Item_func_cos(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "cos"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_sin :public Item_dec_func @@ -582,7 +582,7 @@ public: Item_func_sin(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "sin"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_tan :public Item_dec_func @@ -591,7 +591,7 @@ public: Item_func_tan(Item *a) :Item_dec_func(a) {} double val_real(); const char *func_name() const { return "tan"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_integer :public Item_int_func @@ -668,7 +668,7 @@ public: Item_func_sign(Item *a) :Item_int_func(a) {} const char *func_name() const { return "sign"; } longlong val_int(); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -683,7 +683,7 @@ public: const char *func_name() const { return name; } void fix_length_and_dec() { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -701,7 +701,7 @@ public: my_decimal *val_decimal(my_decimal *); void fix_length_and_dec(); enum Item_result result_type () const { return cmp_type; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_min :public Item_func_min_max @@ -727,7 +727,7 @@ public: longlong val_int(); const char *func_name() const { return "length"; } void fix_length_and_dec() { max_length=10; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_bit_length :public Item_func_length @@ -747,7 +747,7 @@ public: longlong val_int(); const char *func_name() const { return "char_length"; } void fix_length_and_dec() { max_length=10; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_coercibility :public Item_int_func @@ -758,7 +758,7 @@ public: const char *func_name() const { return "coercibility"; } void fix_length_and_dec() { max_length=10; maybe_null= 0; } table_map not_null_tables() const { return 0; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_locate :public Item_int_func @@ -772,7 +772,7 @@ public: longlong val_int(); void fix_length_and_dec(); void print(String *str); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -797,7 +797,7 @@ public: longlong val_int(); const char *func_name() const { return "ascii"; } void fix_length_and_dec() { max_length=3; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_ord :public Item_int_func @@ -807,7 +807,7 @@ public: Item_func_ord(Item *a) :Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "ord"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_find_in_set :public Item_int_func @@ -821,7 +821,7 @@ public: longlong val_int(); const char *func_name() const { return "find_in_set"; } void fix_length_and_dec(); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; /* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */ @@ -833,7 +833,7 @@ public: Item_func_bit(Item *a) :Item_int_func(a) {} void fix_length_and_dec() { unsigned_flag= 1; } void print(String *str) { print_op(str); } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_bit_or :public Item_func_bit @@ -859,7 +859,7 @@ public: longlong val_int(); const char *func_name() const { return "bit_count"; } void fix_length_and_dec() { max_length=2; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_shift_left :public Item_func_bit @@ -1286,7 +1286,7 @@ public: longlong val_int(); const char *func_name() const { return "inet_aton"; } void fix_length_and_dec() { decimals = 0; max_length = 21; maybe_null=1;} - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 5e4fe49e281..2b244347876 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -46,7 +46,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "md5"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -57,7 +57,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "sha"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_aes_encrypt :public Item_str_func @@ -88,7 +88,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "concat"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_concat_ws :public Item_str_func @@ -109,7 +109,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "reverse"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -147,7 +147,7 @@ protected: public: Item_str_conv(Item *item) :Item_str_func(item) {} String *val_str(String *); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -211,7 +211,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "substr"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -223,7 +223,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "substring_index"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -238,7 +238,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "trim"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -418,7 +418,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "soundex"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -526,7 +526,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "rpad"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -539,7 +539,7 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "lpad"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -554,7 +554,7 @@ public: collation.set(default_charset()); decimals=0; max_length=64; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -571,7 +571,7 @@ public: decimals=0; max_length=args[0]->max_length*2*collation.collation->mbmaxlen; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_unhex :public Item_str_func @@ -587,7 +587,7 @@ public: decimals=0; max_length=(1+args[0]->max_length)/2; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -611,7 +611,7 @@ public: } void print(String *str); const char *func_name() const { return "cast_as_binary"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -651,7 +651,7 @@ public: String* val_str(String* str); const char *func_name() const { return "inet_ntoa"; } void fix_length_and_dec() { decimals = 0; max_length=3*8+7; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_quote :public Item_str_func @@ -666,7 +666,7 @@ public: collation.set(args[0]->collation); max_length= args[0]->max_length * 2 + 2; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_conv_charset :public Item_str_func @@ -709,7 +709,7 @@ public: void fix_length_and_dec(); const char *func_name() const { return "convert"; } void print(String *str); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_set_collation :public Item_str_func @@ -742,7 +742,7 @@ public: maybe_null= 0; }; table_map not_null_tables() const { return 0; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_collation :public Item_str_func @@ -758,7 +758,7 @@ public: maybe_null= 0; }; table_map not_null_tables() const { return 0; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_crc32 :public Item_int_func @@ -769,7 +769,7 @@ public: const char *func_name() const { return "crc32"; } void fix_length_and_dec() { max_length=10; } longlong val_int(); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_uncompressed_length : public Item_int_func @@ -780,7 +780,7 @@ public: const char *func_name() const{return "uncompressed_length";} void fix_length_and_dec() { max_length=10; } longlong val_int(); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #ifdef HAVE_COMPRESS @@ -797,7 +797,7 @@ public: void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;} const char *func_name() const{return "compress";} String *val_str(String *) ZLIB_DEPENDED_FUNCTION - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_uncompress: public Item_str_func @@ -808,7 +808,7 @@ public: void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;} const char *func_name() const{return "uncompress";} String *val_str(String *) ZLIB_DEPENDED_FUNCTION - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; #define UUID_LENGTH (8+1+4+1+4+1+4+1+12) diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index a42232fd0fc..cbac0564faf 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -39,7 +39,7 @@ public: { max_length=6*MY_CHARSET_BIN_MB_MAXLEN; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -54,7 +54,7 @@ public: decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -71,7 +71,7 @@ public: maybe_null=1; } enum_monotonicity_info get_monotonicity_info() const; - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -87,7 +87,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -112,7 +112,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -145,7 +145,7 @@ public: max_length=3*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -161,7 +161,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -177,7 +177,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -193,7 +193,7 @@ public: max_length=1*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -209,7 +209,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -225,7 +225,7 @@ public: max_length=2*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_yearweek :public Item_int_func @@ -240,7 +240,7 @@ public: max_length=6*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -257,7 +257,7 @@ public: max_length=4*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -287,7 +287,7 @@ public: max_length=1*MY_CHARSET_BIN_MB_MAXLEN; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_dayname :public Item_func_weekday @@ -320,7 +320,7 @@ public: decimals=0; max_length=10*MY_CHARSET_BIN_MB_MAXLEN; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -335,7 +335,7 @@ public: decimals=0; max_length=10*MY_CHARSET_BIN_MB_MAXLEN; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -542,7 +542,7 @@ public: Item_func_from_days(Item *a) :Item_date(a) {} const char *func_name() const { return "from_days"; } bool get_date(TIME *res, uint fuzzy_date); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -560,7 +560,7 @@ public: void fix_length_and_dec(); uint format_length(const String *format); bool eq(const Item *item, bool binary_cmp) const; - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -579,7 +579,7 @@ class Item_func_from_unixtime :public Item_date_func const char *func_name() const { return "from_unixtime"; } void fix_length_and_dec(); bool get_date(TIME *res, uint fuzzy_date); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -646,7 +646,7 @@ public: { return tmp_table_field_from_field_type(table, 0); } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -669,7 +669,7 @@ public: bool get_date(TIME *res, uint fuzzy_date); bool eq(const Item *item, bool binary_cmp) const; void print(String *str); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -687,7 +687,7 @@ class Item_extract :public Item_int_func void fix_length_and_dec(); bool eq(const Item *item, bool binary_cmp) const; void print(String *str); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -724,7 +724,7 @@ public: max_length=args[0]->max_length; maybe_null= 1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -744,7 +744,7 @@ public: String *val_str(String *a); void fix_length_and_dec(); void print(String *str); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -816,7 +816,7 @@ public: { return tmp_table_field_from_field_type(table, 0); } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -839,7 +839,7 @@ public: } void print(String *str); const char *func_name() const { return "add_time"; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_timediff :public Item_str_func @@ -879,7 +879,7 @@ public: { return tmp_table_field_from_field_type(table, 0); } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; class Item_func_microsecond :public Item_int_func @@ -893,7 +893,7 @@ public: decimals=0; maybe_null=1; } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -911,7 +911,7 @@ public: maybe_null=1; } void print(String *str); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; @@ -958,7 +958,7 @@ public: { return tmp_table_field_from_field_type(table, 1); } - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} }; diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h index 53302283296..e11b4eac1e2 100644 --- a/sql/item_xmlfunc.h +++ b/sql/item_xmlfunc.h @@ -42,7 +42,7 @@ public: Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {} const char *func_name() const { return "extractvalue"; } String *val_str(String *); - virtual bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *bool_arg) { return 0;} };