BUG#18198: Errors due to too much allowed in partition functions

Added functions to enable/disable allowed/disallowed partition functions
parent fe9c6124
...@@ -744,11 +744,22 @@ class Item { ...@@ -744,11 +744,22 @@ class Item {
virtual bool find_item_in_field_list_processor(byte *arg) { return 0; } virtual bool find_item_in_field_list_processor(byte *arg) { return 0; }
virtual bool change_context_processor(byte *context) { return 0; } virtual bool change_context_processor(byte *context) { return 0; }
virtual bool reset_query_id_processor(byte *query_id) { 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) 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 *equal_fields_propagator(byte * arg) { return this; }
virtual Item *set_no_const_sub(byte *arg) { return this; } virtual Item *set_no_const_sub(byte *arg) { return this; }
...@@ -1020,6 +1031,7 @@ class Item_name_const : public Item ...@@ -1020,6 +1031,7 @@ class Item_name_const : public Item
Item::maybe_null= TRUE; Item::maybe_null= TRUE;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0; }
bool fix_fields(THD *, Item **); bool fix_fields(THD *, Item **);
enum Type type() const; enum Type type() const;
...@@ -1066,6 +1078,7 @@ class Item_num: public Item ...@@ -1066,6 +1078,7 @@ class Item_num: public Item
Item_num() {} /* Remove gcc warning */ Item_num() {} /* Remove gcc warning */
virtual Item_num *neg()= 0; virtual Item_num *neg()= 0;
Item *safe_charset_converter(CHARSET_INFO *tocs); 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)) #define NO_CACHED_FIELD_INDEX ((uint)(-1))
...@@ -1251,6 +1264,7 @@ class Item_null :public Item ...@@ -1251,6 +1264,7 @@ class Item_null :public Item
bool is_null() { return 1; } bool is_null() { return 1; }
void print(String *str) { str->append(STRING_WITH_LEN("NULL")); } void print(String *str) { str->append(STRING_WITH_LEN("NULL")); }
Item *safe_charset_converter(CHARSET_INFO *tocs); 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 class Item_null_result :public Item_null
...@@ -1263,6 +1277,8 @@ class Item_null_result :public Item_null ...@@ -1263,6 +1277,8 @@ class Item_null_result :public Item_null
{ {
save_in_field(result_field, no_conversions); 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 */ /* Item represents one placeholder ('?') of prepared statement */
...@@ -1446,6 +1462,8 @@ class Item_static_int_func :public Item_int ...@@ -1446,6 +1462,8 @@ class Item_static_int_func :public Item_int
{} {}
Item *safe_charset_converter(CHARSET_INFO *tocs); Item *safe_charset_converter(CHARSET_INFO *tocs);
void print(String *str) { str->append(func_name); } 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 @@ class Item_static_float_func :public Item_float ...@@ -1564,6 +1582,8 @@ class Item_static_float_func :public Item_float
{} {}
void print(String *str) { str->append(func_name); } void print(String *str) { str->append(func_name); }
Item *safe_charset_converter(CHARSET_INFO *tocs); 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 @@ class Item_string :public Item ...@@ -1641,6 +1661,7 @@ class Item_string :public Item
void print(String *str); void print(String *str);
// to prevent drop fixed flag (no need parent cleanup call) // to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {} void cleanup() {}
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -1655,6 +1676,8 @@ class Item_static_string_func :public Item_string ...@@ -1655,6 +1676,8 @@ class Item_static_string_func :public Item_string
{} {}
Item *safe_charset_converter(CHARSET_INFO *tocs); Item *safe_charset_converter(CHARSET_INFO *tocs);
void print(String *str) { str->append(func_name); } 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 @@ class Item_datetime :public Item_string ...@@ -1667,6 +1690,8 @@ class Item_datetime :public Item_string
&my_charset_bin) &my_charset_bin)
{ max_length=19;} { max_length=19;}
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } 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 class Item_empty_string :public Item_string
...@@ -1689,6 +1714,8 @@ class Item_return_int :public Item_int ...@@ -1689,6 +1714,8 @@ class Item_return_int :public Item_int
unsigned_flag=1; unsigned_flag=1;
} }
enum_field_types field_type() const { return int_field_type; } 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 @@ class Item_hex_string: public Item ...@@ -1712,6 +1739,7 @@ class Item_hex_string: public Item
void cleanup() {} void cleanup() {}
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
virtual Item *safe_charset_converter(CHARSET_INFO *tocs); virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -1949,6 +1977,8 @@ class Item_int_with_ref :public Item_int ...@@ -1949,6 +1977,8 @@ class Item_int_with_ref :public Item_int
} }
Item *new_item(); Item *new_item();
virtual Item *real_item() { return ref; } virtual Item *real_item() { return ref; }
virtual bool check_partition_func_processor(byte *bool_arg)
{ *(bool *)bool_arg= FALSE; return 0; }
}; };
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
......
...@@ -239,6 +239,7 @@ class Item_bool_rowready_func2 :public Item_bool_func2 ...@@ -239,6 +239,7 @@ class Item_bool_rowready_func2 :public Item_bool_func2
} }
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
virtual Item *negated_item(); virtual Item *negated_item();
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_not :public Item_bool_func class Item_func_not :public Item_bool_func
...@@ -249,6 +250,7 @@ class Item_func_not :public Item_bool_func ...@@ -249,6 +250,7 @@ class Item_func_not :public Item_bool_func
enum Functype functype() const { return NOT_FUNC; } enum Functype functype() const { return NOT_FUNC; }
const char *func_name() const { return "not"; } const char *func_name() const { return "not"; }
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_maxmin_subselect; class Item_maxmin_subselect;
...@@ -463,6 +465,7 @@ class Item_func_between :public Item_func_opt_neg ...@@ -463,6 +465,7 @@ class Item_func_between :public Item_func_opt_neg
bool is_bool_func() { return 1; } bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
uint decimal_precision() const { return 1; } uint decimal_precision() const { return 1; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -474,6 +477,7 @@ class Item_func_strcmp :public Item_bool_func2 ...@@ -474,6 +477,7 @@ class Item_func_strcmp :public Item_bool_func2
optimize_type select_optimize() const { return OPTIMIZE_NONE; } optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "strcmp"; } const char *func_name() const { return "strcmp"; }
void print(String *str) { Item_func::print(str); } void print(String *str) { Item_func::print(str); }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -536,6 +540,7 @@ class Item_func_ifnull :public Item_func_coalesce ...@@ -536,6 +540,7 @@ class Item_func_ifnull :public Item_func_coalesce
const char *func_name() const { return "ifnull"; } const char *func_name() const { return "ifnull"; }
Field *tmp_table_field(TABLE *table); Field *tmp_table_field(TABLE *table);
uint decimal_precision() const; uint decimal_precision() const;
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -576,6 +581,7 @@ class Item_func_nullif :public Item_bool_func2 ...@@ -576,6 +581,7 @@ class Item_func_nullif :public Item_bool_func2
void print(String *str) { Item_func::print(str); } void print(String *str) { Item_func::print(str); }
table_map not_null_tables() const { return 0; } table_map not_null_tables() const { return 0; }
bool is_null(); bool is_null();
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -618,6 +624,7 @@ class Item_func_case :public Item_func ...@@ -618,6 +624,7 @@ class Item_func_case :public Item_func
void print(String *str); void print(String *str);
Item *find_item(String *str); Item *find_item(String *str);
CHARSET_INFO *compare_collation() { return cmp_collation.collation; } 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 ...@@ -897,6 +904,7 @@ class Item_func_in :public Item_func_opt_neg
bool nulls_in_row(); bool nulls_in_row();
bool is_bool_func() { return 1; } bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
/* Functions used by where clause */ /* Functions used by where clause */
...@@ -938,6 +946,7 @@ class Item_func_isnull :public Item_bool_func ...@@ -938,6 +946,7 @@ class Item_func_isnull :public Item_bool_func
optimize_type select_optimize() const { return OPTIMIZE_NULL; } optimize_type select_optimize() const { return OPTIMIZE_NULL; }
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } 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 */ /* Functions used by HAVING for rewriting IN subquery */
...@@ -959,6 +968,8 @@ class Item_is_not_null_test :public Item_func_isnull ...@@ -959,6 +968,8 @@ class Item_is_not_null_test :public Item_func_isnull
*/ */
table_map used_tables() const table_map used_tables() const
{ return used_tables_cache | RAND_TABLE_BIT; } { 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 @@ class Item_func_isnotnull :public Item_bool_func ...@@ -981,6 +992,7 @@ class Item_func_isnotnull :public Item_bool_func
void print(String *str); void print(String *str);
CHARSET_INFO *compare_collation() { return args[0]->collation.collation; } CHARSET_INFO *compare_collation() { return args[0]->collation.collation; }
void top_level_item() { abort_on_null=1; } void top_level_item() { abort_on_null=1; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -1019,6 +1031,7 @@ class Item_func_like :public Item_bool_func2 ...@@ -1019,6 +1031,7 @@ class Item_func_like :public Item_bool_func2
const char *func_name() const { return "like"; } const char *func_name() const { return "like"; }
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref);
void cleanup(); void cleanup();
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
#ifdef USE_REGEX #ifdef USE_REGEX
...@@ -1041,6 +1054,7 @@ class Item_func_regex :public Item_bool_func ...@@ -1041,6 +1054,7 @@ class Item_func_regex :public Item_bool_func
const char *func_name() const { return "regexp"; } const char *func_name() const { return "regexp"; }
void print(String *str) { print_op(str); } void print(String *str) { print_op(str); }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
#else #else
...@@ -1097,6 +1111,7 @@ class Item_cond :public Item_bool_func ...@@ -1097,6 +1111,7 @@ class Item_cond :public Item_bool_func
Item *transform(Item_transformer transformer, byte *arg); Item *transform(Item_transformer transformer, byte *arg);
void traverse_cond(Cond_traverser, void *arg, traverse_order order); void traverse_cond(Cond_traverser, void *arg, traverse_order order);
void neg_arguments(THD *thd); void neg_arguments(THD *thd);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
......
...@@ -247,6 +247,7 @@ class Item_func_num1: public Item_func_numhybrid ...@@ -247,6 +247,7 @@ class Item_func_num1: public Item_func_numhybrid
void fix_num_length_and_dec(); void fix_num_length_and_dec();
void find_num_type(); void find_num_type();
String *str_op(String *str) { DBUG_ASSERT(0); return 0; } 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 ...@@ -259,6 +260,7 @@ class Item_num_op :public Item_func_numhybrid
void print(String *str) { print_op(str); } void print(String *str) { print_op(str); }
void find_num_type(); void find_num_type();
String *str_op(String *str) { DBUG_ASSERT(0); return 0; } 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 @@ class Item_func_signed :public Item_int_func ...@@ -296,7 +298,7 @@ class Item_func_signed :public Item_int_func
{ max_length=args[0]->max_length; unsigned_flag=0; } { max_length=args[0]->max_length; unsigned_flag=0; }
void print(String *str); void print(String *str);
uint decimal_precision() const { return args[0]->decimal_precision(); } uint decimal_precision() const { return args[0]->decimal_precision(); }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -330,6 +332,7 @@ class Item_decimal_typecast :public Item_func ...@@ -330,6 +332,7 @@ class Item_decimal_typecast :public Item_func
void fix_length_and_dec() {}; void fix_length_and_dec() {};
const char *func_name() const { return "decimal_typecast"; } const char *func_name() const { return "decimal_typecast"; }
void print(String *); void print(String *);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -398,6 +401,7 @@ class Item_func_int_div :public Item_int_func ...@@ -398,6 +401,7 @@ class Item_func_int_div :public Item_int_func
const char *func_name() const { return "DIV"; } const char *func_name() const { return "DIV"; }
void fix_length_and_dec(); void fix_length_and_dec();
void print(String *str) { print_op(str); } void print(String *str) { print_op(str); }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -470,6 +474,7 @@ class Item_func_exp :public Item_dec_func ...@@ -470,6 +474,7 @@ class Item_func_exp :public Item_dec_func
Item_func_exp(Item *a) :Item_dec_func(a) {} Item_func_exp(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "exp"; } const char *func_name() const { return "exp"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -479,6 +484,7 @@ class Item_func_ln :public Item_dec_func ...@@ -479,6 +484,7 @@ class Item_func_ln :public Item_dec_func
Item_func_ln(Item *a) :Item_dec_func(a) {} Item_func_ln(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "ln"; } const char *func_name() const { return "ln"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -489,6 +495,7 @@ class Item_func_log :public Item_dec_func ...@@ -489,6 +495,7 @@ class Item_func_log :public Item_dec_func
Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {} Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {}
double val_real(); double val_real();
const char *func_name() const { return "log"; } const char *func_name() const { return "log"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -498,6 +505,7 @@ class Item_func_log2 :public Item_dec_func ...@@ -498,6 +505,7 @@ class Item_func_log2 :public Item_dec_func
Item_func_log2(Item *a) :Item_dec_func(a) {} Item_func_log2(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "log2"; } const char *func_name() const { return "log2"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -507,6 +515,7 @@ class Item_func_log10 :public Item_dec_func ...@@ -507,6 +515,7 @@ class Item_func_log10 :public Item_dec_func
Item_func_log10(Item *a) :Item_dec_func(a) {} Item_func_log10(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "log10"; } const char *func_name() const { return "log10"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -516,6 +525,7 @@ class Item_func_sqrt :public Item_dec_func ...@@ -516,6 +525,7 @@ class Item_func_sqrt :public Item_dec_func
Item_func_sqrt(Item *a) :Item_dec_func(a) {} Item_func_sqrt(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "sqrt"; } const char *func_name() const { return "sqrt"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -525,6 +535,7 @@ class Item_func_pow :public Item_dec_func ...@@ -525,6 +535,7 @@ class Item_func_pow :public Item_dec_func
Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {} Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {}
double val_real(); double val_real();
const char *func_name() const { return "pow"; } const char *func_name() const { return "pow"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -534,6 +545,7 @@ class Item_func_acos :public Item_dec_func ...@@ -534,6 +545,7 @@ class Item_func_acos :public Item_dec_func
Item_func_acos(Item *a) :Item_dec_func(a) {} Item_func_acos(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "acos"; } 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 class Item_func_asin :public Item_dec_func
...@@ -542,6 +554,7 @@ class Item_func_asin :public Item_dec_func ...@@ -542,6 +554,7 @@ class Item_func_asin :public Item_dec_func
Item_func_asin(Item *a) :Item_dec_func(a) {} Item_func_asin(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "asin"; } 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 class Item_func_atan :public Item_dec_func
...@@ -551,6 +564,7 @@ class Item_func_atan :public Item_dec_func ...@@ -551,6 +564,7 @@ class Item_func_atan :public Item_dec_func
Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {} Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {}
double val_real(); double val_real();
const char *func_name() const { return "atan"; } 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 class Item_func_cos :public Item_dec_func
...@@ -559,6 +573,7 @@ class Item_func_cos :public Item_dec_func ...@@ -559,6 +573,7 @@ class Item_func_cos :public Item_dec_func
Item_func_cos(Item *a) :Item_dec_func(a) {} Item_func_cos(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "cos"; } 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 class Item_func_sin :public Item_dec_func
...@@ -567,6 +582,7 @@ class Item_func_sin :public Item_dec_func ...@@ -567,6 +582,7 @@ class Item_func_sin :public Item_dec_func
Item_func_sin(Item *a) :Item_dec_func(a) {} Item_func_sin(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "sin"; } 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 class Item_func_tan :public Item_dec_func
...@@ -575,6 +591,7 @@ class Item_func_tan :public Item_dec_func ...@@ -575,6 +591,7 @@ class Item_func_tan :public Item_dec_func
Item_func_tan(Item *a) :Item_dec_func(a) {} Item_func_tan(Item *a) :Item_dec_func(a) {}
double val_real(); double val_real();
const char *func_name() const { return "tan"; } 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 class Item_func_integer :public Item_int_func
...@@ -651,6 +668,7 @@ class Item_func_sign :public Item_int_func ...@@ -651,6 +668,7 @@ class Item_func_sign :public Item_int_func
Item_func_sign(Item *a) :Item_int_func(a) {} Item_func_sign(Item *a) :Item_int_func(a) {}
const char *func_name() const { return "sign"; } const char *func_name() const { return "sign"; }
longlong val_int(); longlong val_int();
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -665,6 +683,7 @@ class Item_func_units :public Item_real_func ...@@ -665,6 +683,7 @@ class Item_func_units :public Item_real_func
const char *func_name() const { return name; } const char *func_name() const { return name; }
void fix_length_and_dec() void fix_length_and_dec()
{ decimals= NOT_FIXED_DEC; max_length= float_length(decimals); } { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -682,6 +701,7 @@ class Item_func_min_max :public Item_func ...@@ -682,6 +701,7 @@ class Item_func_min_max :public Item_func
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *);
void fix_length_and_dec(); void fix_length_and_dec();
enum Item_result result_type () const { return cmp_type; } 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 class Item_func_min :public Item_func_min_max
...@@ -707,6 +727,7 @@ class Item_func_length :public Item_int_func ...@@ -707,6 +727,7 @@ class Item_func_length :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "length"; } const char *func_name() const { return "length"; }
void fix_length_and_dec() { max_length=10; } 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 class Item_func_bit_length :public Item_func_length
...@@ -726,6 +747,7 @@ class Item_func_char_length :public Item_int_func ...@@ -726,6 +747,7 @@ class Item_func_char_length :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "char_length"; } const char *func_name() const { return "char_length"; }
void fix_length_and_dec() { max_length=10; } 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 class Item_func_coercibility :public Item_int_func
...@@ -736,6 +758,7 @@ class Item_func_coercibility :public Item_int_func ...@@ -736,6 +758,7 @@ class Item_func_coercibility :public Item_int_func
const char *func_name() const { return "coercibility"; } const char *func_name() const { return "coercibility"; }
void fix_length_and_dec() { max_length=10; maybe_null= 0; } void fix_length_and_dec() { max_length=10; maybe_null= 0; }
table_map not_null_tables() const { return 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 class Item_func_locate :public Item_int_func
...@@ -749,6 +772,7 @@ class Item_func_locate :public Item_int_func ...@@ -749,6 +772,7 @@ class Item_func_locate :public Item_int_func
longlong val_int(); longlong val_int();
void fix_length_and_dec(); void fix_length_and_dec();
void print(String *str); void print(String *str);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -773,6 +797,7 @@ class Item_func_ascii :public Item_int_func ...@@ -773,6 +797,7 @@ class Item_func_ascii :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "ascii"; } const char *func_name() const { return "ascii"; }
void fix_length_and_dec() { max_length=3; } 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 class Item_func_ord :public Item_int_func
...@@ -782,6 +807,7 @@ class Item_func_ord :public Item_int_func ...@@ -782,6 +807,7 @@ class Item_func_ord :public Item_int_func
Item_func_ord(Item *a) :Item_int_func(a) {} Item_func_ord(Item *a) :Item_int_func(a) {}
longlong val_int(); longlong val_int();
const char *func_name() const { return "ord"; } 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 class Item_func_find_in_set :public Item_int_func
...@@ -795,6 +821,7 @@ class Item_func_find_in_set :public Item_int_func ...@@ -795,6 +821,7 @@ class Item_func_find_in_set :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "find_in_set"; } const char *func_name() const { return "find_in_set"; }
void fix_length_and_dec(); void fix_length_and_dec();
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */ /* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
...@@ -806,6 +833,7 @@ class Item_func_bit: public Item_int_func ...@@ -806,6 +833,7 @@ class Item_func_bit: public Item_int_func
Item_func_bit(Item *a) :Item_int_func(a) {} Item_func_bit(Item *a) :Item_int_func(a) {}
void fix_length_and_dec() { unsigned_flag= 1; } void fix_length_and_dec() { unsigned_flag= 1; }
void print(String *str) { print_op(str); } 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 class Item_func_bit_or :public Item_func_bit
...@@ -831,6 +859,7 @@ class Item_func_bit_count :public Item_int_func ...@@ -831,6 +859,7 @@ class Item_func_bit_count :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "bit_count"; } const char *func_name() const { return "bit_count"; }
void fix_length_and_dec() { max_length=2; } 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 class Item_func_shift_left :public Item_func_bit
...@@ -1257,6 +1286,7 @@ class Item_func_inet_aton : public Item_int_func ...@@ -1257,6 +1286,7 @@ class Item_func_inet_aton : public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "inet_aton"; } const char *func_name() const { return "inet_aton"; }
void fix_length_and_dec() { decimals = 0; max_length = 21; maybe_null=1;} void fix_length_and_dec() { decimals = 0; max_length = 21; maybe_null=1;}
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
......
...@@ -46,6 +46,7 @@ class Item_func_md5 :public Item_str_func ...@@ -46,6 +46,7 @@ class Item_func_md5 :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "md5"; } const char *func_name() const { return "md5"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -56,6 +57,7 @@ class Item_func_sha :public Item_str_func ...@@ -56,6 +57,7 @@ class Item_func_sha :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "sha"; } 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 class Item_func_aes_encrypt :public Item_str_func
...@@ -86,6 +88,7 @@ class Item_func_concat :public Item_str_func ...@@ -86,6 +88,7 @@ class Item_func_concat :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "concat"; } 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 class Item_func_concat_ws :public Item_str_func
...@@ -106,6 +109,7 @@ class Item_func_reverse :public Item_str_func ...@@ -106,6 +109,7 @@ class Item_func_reverse :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "reverse"; } const char *func_name() const { return "reverse"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -143,6 +147,7 @@ class Item_str_conv :public Item_str_func ...@@ -143,6 +147,7 @@ class Item_str_conv :public Item_str_func
public: public:
Item_str_conv(Item *item) :Item_str_func(item) {} Item_str_conv(Item *item) :Item_str_func(item) {}
String *val_str(String *); String *val_str(String *);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -206,6 +211,7 @@ class Item_func_substr :public Item_str_func ...@@ -206,6 +211,7 @@ class Item_func_substr :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "substr"; } const char *func_name() const { return "substr"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -217,6 +223,7 @@ class Item_func_substr_index :public Item_str_func ...@@ -217,6 +223,7 @@ class Item_func_substr_index :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "substring_index"; } const char *func_name() const { return "substring_index"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -231,6 +238,7 @@ class Item_func_trim :public Item_str_func ...@@ -231,6 +238,7 @@ class Item_func_trim :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "trim"; } const char *func_name() const { return "trim"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -410,6 +418,7 @@ class Item_func_soundex :public Item_str_func ...@@ -410,6 +418,7 @@ class Item_func_soundex :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "soundex"; } const char *func_name() const { return "soundex"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -517,6 +526,7 @@ class Item_func_rpad :public Item_str_func ...@@ -517,6 +526,7 @@ class Item_func_rpad :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "rpad"; } const char *func_name() const { return "rpad"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -529,6 +539,7 @@ class Item_func_lpad :public Item_str_func ...@@ -529,6 +539,7 @@ class Item_func_lpad :public Item_str_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "lpad"; } const char *func_name() const { return "lpad"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -543,6 +554,7 @@ class Item_func_conv :public Item_str_func ...@@ -543,6 +554,7 @@ class Item_func_conv :public Item_str_func
collation.set(default_charset()); collation.set(default_charset());
decimals=0; max_length=64; decimals=0; max_length=64;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -559,6 +571,7 @@ class Item_func_hex :public Item_str_func ...@@ -559,6 +571,7 @@ class Item_func_hex :public Item_str_func
decimals=0; decimals=0;
max_length=args[0]->max_length*2*collation.collation->mbmaxlen; 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 class Item_func_unhex :public Item_str_func
...@@ -574,6 +587,7 @@ class Item_func_unhex :public Item_str_func ...@@ -574,6 +587,7 @@ class Item_func_unhex :public Item_str_func
decimals=0; decimals=0;
max_length=(1+args[0]->max_length)/2; max_length=(1+args[0]->max_length)/2;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -597,6 +611,7 @@ class Item_func_binary :public Item_str_func ...@@ -597,6 +611,7 @@ class Item_func_binary :public Item_str_func
} }
void print(String *str); void print(String *str);
const char *func_name() const { return "cast_as_binary"; } const char *func_name() const { return "cast_as_binary"; }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -636,6 +651,7 @@ class Item_func_inet_ntoa : public Item_str_func ...@@ -636,6 +651,7 @@ class Item_func_inet_ntoa : public Item_str_func
String* val_str(String* str); String* val_str(String* str);
const char *func_name() const { return "inet_ntoa"; } const char *func_name() const { return "inet_ntoa"; }
void fix_length_and_dec() { decimals = 0; max_length=3*8+7; } 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 class Item_func_quote :public Item_str_func
...@@ -650,6 +666,7 @@ class Item_func_quote :public Item_str_func ...@@ -650,6 +666,7 @@ class Item_func_quote :public Item_str_func
collation.set(args[0]->collation); collation.set(args[0]->collation);
max_length= args[0]->max_length * 2 + 2; 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 class Item_func_conv_charset :public Item_str_func
...@@ -692,6 +709,7 @@ class Item_func_conv_charset :public Item_str_func ...@@ -692,6 +709,7 @@ class Item_func_conv_charset :public Item_str_func
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "convert"; } const char *func_name() const { return "convert"; }
void print(String *str); void print(String *str);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_set_collation :public Item_str_func class Item_func_set_collation :public Item_str_func
...@@ -724,6 +742,7 @@ class Item_func_charset :public Item_str_func ...@@ -724,6 +742,7 @@ class Item_func_charset :public Item_str_func
maybe_null= 0; maybe_null= 0;
}; };
table_map not_null_tables() const { return 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 class Item_func_collation :public Item_str_func
...@@ -739,6 +758,7 @@ class Item_func_collation :public Item_str_func ...@@ -739,6 +758,7 @@ class Item_func_collation :public Item_str_func
maybe_null= 0; maybe_null= 0;
}; };
table_map not_null_tables() const { return 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 class Item_func_crc32 :public Item_int_func
...@@ -749,6 +769,7 @@ class Item_func_crc32 :public Item_int_func ...@@ -749,6 +769,7 @@ class Item_func_crc32 :public Item_int_func
const char *func_name() const { return "crc32"; } const char *func_name() const { return "crc32"; }
void fix_length_and_dec() { max_length=10; } void fix_length_and_dec() { max_length=10; }
longlong val_int(); longlong val_int();
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_uncompressed_length : public Item_int_func class Item_func_uncompressed_length : public Item_int_func
...@@ -759,6 +780,7 @@ class Item_func_uncompressed_length : public Item_int_func ...@@ -759,6 +780,7 @@ class Item_func_uncompressed_length : public Item_int_func
const char *func_name() const{return "uncompressed_length";} const char *func_name() const{return "uncompressed_length";}
void fix_length_and_dec() { max_length=10; } void fix_length_and_dec() { max_length=10; }
longlong val_int(); longlong val_int();
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
#ifdef HAVE_COMPRESS #ifdef HAVE_COMPRESS
...@@ -775,6 +797,7 @@ class Item_func_compress: public Item_str_func ...@@ -775,6 +797,7 @@ class Item_func_compress: public Item_str_func
void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;} void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
const char *func_name() const{return "compress";} const char *func_name() const{return "compress";}
String *val_str(String *) ZLIB_DEPENDED_FUNCTION 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 class Item_func_uncompress: public Item_str_func
...@@ -785,6 +808,7 @@ class Item_func_uncompress: public Item_str_func ...@@ -785,6 +808,7 @@ class Item_func_uncompress: public Item_str_func
void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;} void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;}
const char *func_name() const{return "uncompress";} const char *func_name() const{return "uncompress";}
String *val_str(String *) ZLIB_DEPENDED_FUNCTION 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) #define UUID_LENGTH (8+1+4+1+4+1+4+1+12)
......
...@@ -39,6 +39,7 @@ class Item_func_period_add :public Item_int_func ...@@ -39,6 +39,7 @@ class Item_func_period_add :public Item_int_func
{ {
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -53,6 +54,7 @@ class Item_func_period_diff :public Item_int_func ...@@ -53,6 +54,7 @@ class Item_func_period_diff :public Item_int_func
decimals=0; decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -69,6 +71,7 @@ class Item_func_to_days :public Item_int_func ...@@ -69,6 +71,7 @@ class Item_func_to_days :public Item_int_func
maybe_null=1; maybe_null=1;
} }
enum_monotonicity_info get_monotonicity_info() const; enum_monotonicity_info get_monotonicity_info() const;
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -84,6 +87,7 @@ class Item_func_dayofmonth :public Item_int_func ...@@ -84,6 +87,7 @@ class Item_func_dayofmonth :public Item_int_func
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -108,6 +112,7 @@ class Item_func_month :public Item_func ...@@ -108,6 +112,7 @@ class Item_func_month :public Item_func
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -140,6 +145,7 @@ class Item_func_dayofyear :public Item_int_func ...@@ -140,6 +145,7 @@ class Item_func_dayofyear :public Item_int_func
max_length=3*MY_CHARSET_BIN_MB_MAXLEN; max_length=3*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -155,6 +161,7 @@ class Item_func_hour :public Item_int_func ...@@ -155,6 +161,7 @@ class Item_func_hour :public Item_int_func
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -170,6 +177,7 @@ class Item_func_minute :public Item_int_func ...@@ -170,6 +177,7 @@ class Item_func_minute :public Item_int_func
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -185,6 +193,7 @@ class Item_func_quarter :public Item_int_func ...@@ -185,6 +193,7 @@ class Item_func_quarter :public Item_int_func
max_length=1*MY_CHARSET_BIN_MB_MAXLEN; max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -200,6 +209,7 @@ class Item_func_second :public Item_int_func ...@@ -200,6 +209,7 @@ class Item_func_second :public Item_int_func
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -215,6 +225,7 @@ class Item_func_week :public Item_int_func ...@@ -215,6 +225,7 @@ class Item_func_week :public Item_int_func
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_yearweek :public Item_int_func class Item_func_yearweek :public Item_int_func
...@@ -229,6 +240,7 @@ class Item_func_yearweek :public Item_int_func ...@@ -229,6 +240,7 @@ class Item_func_yearweek :public Item_int_func
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -245,6 +257,7 @@ class Item_func_year :public Item_int_func ...@@ -245,6 +257,7 @@ class Item_func_year :public Item_int_func
max_length=4*MY_CHARSET_BIN_MB_MAXLEN; max_length=4*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -274,6 +287,7 @@ class Item_func_weekday :public Item_func ...@@ -274,6 +287,7 @@ class Item_func_weekday :public Item_func
max_length=1*MY_CHARSET_BIN_MB_MAXLEN; max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
class Item_func_dayname :public Item_func_weekday class Item_func_dayname :public Item_func_weekday
...@@ -306,6 +320,7 @@ class Item_func_unix_timestamp :public Item_int_func ...@@ -306,6 +320,7 @@ class Item_func_unix_timestamp :public Item_int_func
decimals=0; decimals=0;
max_length=10*MY_CHARSET_BIN_MB_MAXLEN; max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -320,6 +335,7 @@ class Item_func_time_to_sec :public Item_int_func ...@@ -320,6 +335,7 @@ class Item_func_time_to_sec :public Item_int_func
decimals=0; decimals=0;
max_length=10*MY_CHARSET_BIN_MB_MAXLEN; max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -526,6 +542,7 @@ class Item_func_from_days :public Item_date ...@@ -526,6 +542,7 @@ class Item_func_from_days :public Item_date
Item_func_from_days(Item *a) :Item_date(a) {} Item_func_from_days(Item *a) :Item_date(a) {}
const char *func_name() const { return "from_days"; } const char *func_name() const { return "from_days"; }
bool get_date(TIME *res, uint fuzzy_date); bool get_date(TIME *res, uint fuzzy_date);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -543,6 +560,7 @@ class Item_func_date_format :public Item_str_func ...@@ -543,6 +560,7 @@ class Item_func_date_format :public Item_str_func
void fix_length_and_dec(); void fix_length_and_dec();
uint format_length(const String *format); uint format_length(const String *format);
bool eq(const Item *item, bool binary_cmp) const; 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 ...@@ -561,6 +579,7 @@ class Item_func_from_unixtime :public Item_date_func
const char *func_name() const { return "from_unixtime"; } const char *func_name() const { return "from_unixtime"; }
void fix_length_and_dec(); void fix_length_and_dec();
bool get_date(TIME *res, uint fuzzy_date); bool get_date(TIME *res, uint fuzzy_date);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -627,6 +646,7 @@ class Item_func_sec_to_time :public Item_str_func ...@@ -627,6 +646,7 @@ class Item_func_sec_to_time :public Item_str_func
{ {
return tmp_table_field_from_field_type(table, 0); return tmp_table_field_from_field_type(table, 0);
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -648,6 +668,7 @@ class Item_date_add_interval :public Item_date_func ...@@ -648,6 +668,7 @@ class Item_date_add_interval :public Item_date_func
longlong val_int(); longlong val_int();
bool get_date(TIME *res, uint fuzzy_date); bool get_date(TIME *res, uint fuzzy_date);
void print(String *str); 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 ...@@ -665,6 +686,7 @@ class Item_extract :public Item_int_func
void fix_length_and_dec(); void fix_length_and_dec();
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
void print(String *str); void print(String *str);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -701,6 +723,7 @@ class Item_typecast_maybe_null :public Item_typecast ...@@ -701,6 +723,7 @@ class Item_typecast_maybe_null :public Item_typecast
max_length=args[0]->max_length; max_length=args[0]->max_length;
maybe_null= 1; maybe_null= 1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -720,6 +743,7 @@ class Item_char_typecast :public Item_typecast ...@@ -720,6 +743,7 @@ class Item_char_typecast :public Item_typecast
String *val_str(String *a); String *val_str(String *a);
void fix_length_and_dec(); void fix_length_and_dec();
void print(String *str); void print(String *str);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -791,6 +815,7 @@ class Item_func_makedate :public Item_str_func ...@@ -791,6 +815,7 @@ class Item_func_makedate :public Item_str_func
{ {
return tmp_table_field_from_field_type(table, 0); return tmp_table_field_from_field_type(table, 0);
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -813,6 +838,7 @@ class Item_func_add_time :public Item_str_func ...@@ -813,6 +838,7 @@ class Item_func_add_time :public Item_str_func
} }
void print(String *str); void print(String *str);
const char *func_name() const { return "add_time"; } 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 class Item_func_timediff :public Item_str_func
...@@ -852,6 +878,7 @@ class Item_func_maketime :public Item_str_func ...@@ -852,6 +878,7 @@ class Item_func_maketime :public Item_str_func
{ {
return tmp_table_field_from_field_type(table, 0); 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 class Item_func_microsecond :public Item_int_func
...@@ -865,6 +892,7 @@ class Item_func_microsecond :public Item_int_func ...@@ -865,6 +892,7 @@ class Item_func_microsecond :public Item_int_func
decimals=0; decimals=0;
maybe_null=1; maybe_null=1;
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -882,6 +910,7 @@ class Item_func_timestamp_diff :public Item_int_func ...@@ -882,6 +910,7 @@ class Item_func_timestamp_diff :public Item_int_func
maybe_null=1; maybe_null=1;
} }
void print(String *str); void print(String *str);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
...@@ -928,6 +957,7 @@ class Item_func_str_to_date :public Item_str_func ...@@ -928,6 +957,7 @@ class Item_func_str_to_date :public Item_str_func
{ {
return tmp_table_field_from_field_type(table, 1); return tmp_table_field_from_field_type(table, 1);
} }
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
......
...@@ -42,6 +42,7 @@ class Item_func_xml_extractvalue: public Item_xml_str_func ...@@ -42,6 +42,7 @@ class Item_func_xml_extractvalue: public Item_xml_str_func
Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {} Item_func_xml_extractvalue(Item *a,Item *b) :Item_xml_str_func(a,b) {}
const char *func_name() const { return "extractvalue"; } const char *func_name() const { return "extractvalue"; }
String *val_str(String *); String *val_str(String *);
virtual bool check_partition_func_processor(byte *bool_arg) { return 0;}
}; };
......
...@@ -659,14 +659,14 @@ bool partition_info::check_partition_info(handlerton **eng_type, ...@@ -659,14 +659,14 @@ bool partition_info::check_partition_info(handlerton **eng_type,
DBUG_ENTER("partition_info::check_partition_info"); DBUG_ENTER("partition_info::check_partition_info");
if (part_type != HASH_PARTITION || !list_of_part_fields) if (part_type != HASH_PARTITION || !list_of_part_fields)
part_expr->walk(Item::check_partition_func_processor, part_expr->walk(&Item::check_partition_func_processor,
(byte*)&part_expression_ok); (byte*)(&part_expression_ok));
if (is_sub_partitioned() && !list_of_subpart_fields) if (is_sub_partitioned() && !list_of_subpart_fields)
subpart_expr->walk(Item::check_partition_func_processor, subpart_expr->walk(&Item::check_partition_func_processor,
(byte*)&part_expression_ok); (byte*)(&part_expression_ok));
if (!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; goto end;
} }
if (unlikely(!is_sub_partitioned() && if (unlikely(!is_sub_partitioned() &&
......
...@@ -5826,6 +5826,6 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT ...@@ -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" eng "The NDB cluster engine does not support changing the binlog format on the fly yet"
ER_PARTITION_NO_TEMPORARY ER_PARTITION_NO_TEMPORARY
eng "Cannot create temporary table with partitions" 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" eng "This partition function is not allowed"
swe "Denna partitioneringsfunktion r inte tillten" swe "Denna partitioneringsfunktion r inte tillten"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment