From 5771a711f070d94e315641a6bcbe770ac8791c15 Mon Sep 17 00:00:00 2001 From: "mikael@dator5.(none)" <> Date: Fri, 23 Jun 2006 01:21:26 -0400 Subject: BUG#18198: Less flexibility in defining partition functions Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations --- sql/item_cmpfunc.h | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'sql/item_cmpfunc.h') diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 82cb5febe7d..08b8d4a4d99 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -240,7 +240,8 @@ public: } Item *neg_transformer(THD *thd); virtual Item *negated_item(); - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) + { return safe_for_single_char_collation(int_arg); } }; class Item_func_not :public Item_bool_func @@ -251,7 +252,8 @@ public: enum Functype functype() const { return NOT_FUNC; } const char *func_name() const { return "not"; } Item *neg_transformer(THD *thd); - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) + { return safe_for_single_char_collation(int_arg); } }; class Item_maxmin_subselect; @@ -466,7 +468,8 @@ public: bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } uint decimal_precision() const { return 1; } - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) + { return safe_for_single_char_collation(int_arg); } }; @@ -478,7 +481,8 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "strcmp"; } void print(String *str) { Item_func::print(str); } - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) + { return safe_for_single_char_collation(int_arg); } }; @@ -541,7 +545,7 @@ public: const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); uint decimal_precision() const; - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) { return 0;} }; @@ -582,7 +586,7 @@ public: void print(String *str) { Item_func::print(str); } table_map not_null_tables() const { return 0; } bool is_null(); - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) { return 0;} }; @@ -625,7 +629,8 @@ public: void print(String *str); Item *find_item(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) + { return safe_for_single_char_collation(int_arg); } }; @@ -976,7 +981,8 @@ public: bool nulls_in_row(); bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) + { return safe_for_single_char_collation(int_arg); } }; /* Functions used by where clause */ @@ -1018,7 +1024,7 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NULL; } Item *neg_transformer(THD *thd); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) { return 0;} }; /* Functions used by HAVING for rewriting IN subquery */ @@ -1040,8 +1046,8 @@ public: */ table_map used_tables() const { return used_tables_cache | RAND_TABLE_BIT; } - bool check_partition_func_processor(byte *bool_arg) - { *(bool *)bool_arg= FALSE; return 0; } + bool check_partition_func_processor(byte *int_arg) + { *(int *)int_arg= PF_UNSAFE; return 0; } }; @@ -1064,7 +1070,7 @@ public: void print(String *str); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } void top_level_item() { abort_on_null=1; } - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) { return 0;} }; @@ -1103,7 +1109,8 @@ public: const char *func_name() const { return "like"; } bool fix_fields(THD *thd, Item **ref); void cleanup(); - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) + { return safe_for_single_char_collation(int_arg); } }; #ifdef USE_REGEX @@ -1126,7 +1133,8 @@ public: const char *func_name() const { return "regexp"; } void print(String *str) { print_op(str); } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) + { return safe_for_single_char_collation(int_arg); } }; #else @@ -1183,7 +1191,8 @@ public: Item *transform(Item_transformer transformer, byte *arg); void traverse_cond(Cond_traverser, void *arg, traverse_order order); void neg_arguments(THD *thd); - bool check_partition_func_processor(byte *bool_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) + { return safe_for_single_char_collation(int_arg); } }; -- cgit v1.2.1 From 21f8aef468011654cd6f489289ee58ab06456fc9 Mon Sep 17 00:00:00 2001 From: "mikael/pappa@dator5.(none)" <> Date: Thu, 13 Jul 2006 20:37:17 -0400 Subject: BUG#18198: Partition function bug Review fixes --- sql/item_cmpfunc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/item_cmpfunc.h') diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 08b8d4a4d99..b576f53ad2d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1134,7 +1134,7 @@ public: void print(String *str) { print_op(str); } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } bool check_partition_func_processor(byte *int_arg) - { return safe_for_single_char_collation(int_arg); } + { return safe_for_binary_collation(int_arg); } }; #else -- cgit v1.2.1 From 032d208be21ad47671b86ec7bec14162883e7616 Mon Sep 17 00:00:00 2001 From: "mikael/pappa@dator5.(none)" <> Date: Fri, 21 Jul 2006 10:23:32 -0400 Subject: BUG#18198: Partition function handling Review fixes --- sql/item_cmpfunc.h | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'sql/item_cmpfunc.h') diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index b576f53ad2d..d84e73ff6a5 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -240,8 +240,7 @@ public: } Item *neg_transformer(THD *thd); virtual Item *negated_item(); - bool check_partition_func_processor(byte *int_arg) - { return safe_for_single_char_collation(int_arg); } + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; class Item_func_not :public Item_bool_func @@ -252,8 +251,7 @@ public: enum Functype functype() const { return NOT_FUNC; } const char *func_name() const { return "not"; } Item *neg_transformer(THD *thd); - bool check_partition_func_processor(byte *int_arg) - { return safe_for_single_char_collation(int_arg); } + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; class Item_maxmin_subselect; @@ -468,8 +466,7 @@ public: bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } uint decimal_precision() const { return 1; } - bool check_partition_func_processor(byte *int_arg) - { return safe_for_single_char_collation(int_arg); } + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; @@ -481,8 +478,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); } - bool check_partition_func_processor(byte *int_arg) - { return safe_for_single_char_collation(int_arg); } + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; @@ -545,7 +541,7 @@ public: const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); uint decimal_precision() const; - bool check_partition_func_processor(byte *int_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; @@ -586,7 +582,7 @@ public: void print(String *str) { Item_func::print(str); } table_map not_null_tables() const { return 0; } bool is_null(); - bool check_partition_func_processor(byte *int_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; @@ -629,8 +625,7 @@ public: void print(String *str); Item *find_item(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *int_arg) - { return safe_for_single_char_collation(int_arg); } + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; @@ -981,8 +976,7 @@ public: bool nulls_in_row(); bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *int_arg) - { return safe_for_single_char_collation(int_arg); } + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; /* Functions used by where clause */ @@ -1024,7 +1018,7 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NULL; } Item *neg_transformer(THD *thd); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } - bool check_partition_func_processor(byte *int_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; /* Functions used by HAVING for rewriting IN subquery */ @@ -1047,7 +1041,7 @@ public: table_map used_tables() const { return used_tables_cache | RAND_TABLE_BIT; } bool check_partition_func_processor(byte *int_arg) - { *(int *)int_arg= PF_UNSAFE; return 0; } + { *(int *)int_arg= 0; return FALSE; } }; @@ -1070,7 +1064,7 @@ public: void print(String *str); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } void top_level_item() { abort_on_null=1; } - bool check_partition_func_processor(byte *int_arg) { return 0;} + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; @@ -1109,8 +1103,7 @@ public: const char *func_name() const { return "like"; } bool fix_fields(THD *thd, Item **ref); void cleanup(); - bool check_partition_func_processor(byte *int_arg) - { return safe_for_single_char_collation(int_arg); } + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; #ifdef USE_REGEX @@ -1133,8 +1126,7 @@ public: const char *func_name() const { return "regexp"; } void print(String *str) { print_op(str); } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *int_arg) - { return safe_for_binary_collation(int_arg); } + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; #else @@ -1191,8 +1183,7 @@ public: Item *transform(Item_transformer transformer, byte *arg); void traverse_cond(Cond_traverser, void *arg, traverse_order order); void neg_arguments(THD *thd); - bool check_partition_func_processor(byte *int_arg) - { return safe_for_single_char_collation(int_arg); } + bool check_partition_func_processor(byte *int_arg) { return FALSE; } }; -- cgit v1.2.1 From 58ee682e9d3daf27c771a34b0a465e29a29b2205 Mon Sep 17 00:00:00 2001 From: "mikael/pappa@dator5.(none)" <> Date: Tue, 26 Sep 2006 02:25:23 -0400 Subject: BUG#18198 Review comments --- sql/item_cmpfunc.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'sql/item_cmpfunc.h') diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index a3b8d9757d8..18badc71c1d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -240,7 +240,7 @@ public: } Item *neg_transformer(THD *thd); virtual Item *negated_item(); - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} bool subst_argument_checker(byte **arg) { return TRUE; } }; @@ -252,7 +252,7 @@ public: enum Functype functype() const { return NOT_FUNC; } const char *func_name() const { return "not"; } Item *neg_transformer(THD *thd); - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; class Item_maxmin_subselect; @@ -469,7 +469,7 @@ public: bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } uint decimal_precision() const { return 1; } - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; @@ -481,7 +481,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); } - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; @@ -544,7 +544,7 @@ public: const char *func_name() const { return "ifnull"; } Field *tmp_table_field(TABLE *table); uint decimal_precision() const; - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; @@ -585,7 +585,7 @@ public: void print(String *str) { Item_func::print(str); } table_map not_null_tables() const { return 0; } bool is_null(); - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; @@ -628,7 +628,7 @@ public: void print(String *str); Item *find_item(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; @@ -979,7 +979,7 @@ public: bool nulls_in_row(); bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; /* Functions used by where clause */ @@ -1021,7 +1021,7 @@ public: optimize_type select_optimize() const { return OPTIMIZE_NULL; } Item *neg_transformer(THD *thd); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; /* Functions used by HAVING for rewriting IN subquery */ @@ -1043,8 +1043,7 @@ public: */ table_map used_tables() const { return used_tables_cache | RAND_TABLE_BIT; } - bool check_partition_func_processor(byte *int_arg) - { *(int *)int_arg= 0; return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return TRUE;} }; @@ -1067,7 +1066,7 @@ public: void print(String *str); CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } void top_level_item() { abort_on_null=1; } - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; @@ -1106,7 +1105,7 @@ public: const char *func_name() const { return "like"; } bool fix_fields(THD *thd, Item **ref); void cleanup(); - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; #ifdef USE_REGEX @@ -1129,7 +1128,7 @@ public: const char *func_name() const { return "regexp"; } void print(String *str) { print_op(str); } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} }; #else @@ -1186,7 +1185,7 @@ public: Item *transform(Item_transformer transformer, byte *arg); void traverse_cond(Cond_traverser, void *arg, traverse_order order); void neg_arguments(THD *thd); - bool check_partition_func_processor(byte *int_arg) { return FALSE; } + bool check_partition_func_processor(byte *int_arg) {return FALSE;} bool subst_argument_checker(byte **arg) { return TRUE; } Item *compile(Item_analyzer analyzer, byte **arg_p, Item_transformer transformer, byte *arg_t); -- cgit v1.2.1