Commit 93dc62c3 authored by Mattias Jonsson's avatar Mattias Jonsson

Bug#54483: valgrind errors when making warnings for

multiline inserts into partition
Bug#57071: EXTRACT(WEEK from date_col) cannot be
allowed as partitioning function

Renamed function according to reviewers comments.

sql/item.h:
  better name of processor function
sql/item_func.h:
  better name of processor function
sql/item_timefunc.h:
  better name of processor function
sql/sql_partition.cc:
  better name of processor function
  Updated comment.
parent 969e729a
...@@ -970,7 +970,7 @@ class Item { ...@@ -970,7 +970,7 @@ class Item {
for date functions. Also used by partitioning code to reject for date functions. Also used by partitioning code to reject
timezone-dependent expressions in a (sub)partitioning function. timezone-dependent expressions in a (sub)partitioning function.
*/ */
virtual bool is_arguments_valid_processor(uchar *bool_arg) virtual bool check_valid_arguments_processor(uchar *bool_arg)
{ {
return FALSE; return FALSE;
} }
......
...@@ -248,7 +248,7 @@ class Item_func :public Item_result_field ...@@ -248,7 +248,7 @@ class Item_func :public Item_result_field
representation of a TIMESTAMP argument verbatim, and thus does not depend on representation of a TIMESTAMP argument verbatim, and thus does not depend on
the timezone. the timezone.
*/ */
virtual bool is_arguments_valid_processor(uchar *bool_arg) virtual bool check_valid_arguments_processor(uchar *bool_arg)
{ {
return has_timestamp_args(); return has_timestamp_args();
} }
......
...@@ -70,7 +70,7 @@ class Item_func_to_days :public Item_int_func ...@@ -70,7 +70,7 @@ class Item_func_to_days :public Item_int_func
enum_monotonicity_info get_monotonicity_info() const; enum_monotonicity_info get_monotonicity_info() const;
longlong val_int_endpoint(bool left_endp, bool *incl_endp); longlong val_int_endpoint(bool left_endp, bool *incl_endp);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_date_args(); return !has_date_args();
} }
...@@ -90,7 +90,7 @@ class Item_func_dayofmonth :public Item_int_func ...@@ -90,7 +90,7 @@ class Item_func_dayofmonth :public Item_int_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_date_args(); return !has_date_args();
} }
...@@ -119,7 +119,7 @@ class Item_func_month :public Item_func ...@@ -119,7 +119,7 @@ class Item_func_month :public Item_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_date_args(); return !has_date_args();
} }
...@@ -152,7 +152,7 @@ class Item_func_dayofyear :public Item_int_func ...@@ -152,7 +152,7 @@ class Item_func_dayofyear :public Item_int_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_date_args(); return !has_date_args();
} }
...@@ -172,7 +172,7 @@ class Item_func_hour :public Item_int_func ...@@ -172,7 +172,7 @@ class Item_func_hour :public Item_int_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_time_args(); return !has_time_args();
} }
...@@ -192,7 +192,7 @@ class Item_func_minute :public Item_int_func ...@@ -192,7 +192,7 @@ class Item_func_minute :public Item_int_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_time_args(); return !has_time_args();
} }
...@@ -212,7 +212,7 @@ class Item_func_quarter :public Item_int_func ...@@ -212,7 +212,7 @@ class Item_func_quarter :public Item_int_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_date_args(); return !has_date_args();
} }
...@@ -232,7 +232,7 @@ class Item_func_second :public Item_int_func ...@@ -232,7 +232,7 @@ class Item_func_second :public Item_int_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_time_args(); return !has_time_args();
} }
...@@ -266,7 +266,7 @@ class Item_func_yearweek :public Item_int_func ...@@ -266,7 +266,7 @@ class Item_func_yearweek :public Item_int_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_date_args(); return !has_date_args();
} }
...@@ -288,7 +288,7 @@ class Item_func_year :public Item_int_func ...@@ -288,7 +288,7 @@ class Item_func_year :public Item_int_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_date_args(); return !has_date_args();
} }
...@@ -322,7 +322,7 @@ class Item_func_weekday :public Item_func ...@@ -322,7 +322,7 @@ class Item_func_weekday :public Item_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_date_args(); return !has_date_args();
} }
...@@ -355,7 +355,7 @@ class Item_func_unix_timestamp :public Item_int_func ...@@ -355,7 +355,7 @@ class Item_func_unix_timestamp :public Item_int_func
(and thus may not be used as a partitioning function) (and thus may not be used as a partitioning function)
when its argument is NOT of the TIMESTAMP type. when its argument is NOT of the TIMESTAMP type.
*/ */
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_timestamp_args(); return !has_timestamp_args();
} }
...@@ -380,7 +380,7 @@ class Item_func_time_to_sec :public Item_int_func ...@@ -380,7 +380,7 @@ class Item_func_time_to_sec :public Item_int_func
max_length=10*MY_CHARSET_BIN_MB_MAXLEN; max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_time_args(); return !has_time_args();
} }
...@@ -637,7 +637,7 @@ class Item_func_from_days :public Item_date ...@@ -637,7 +637,7 @@ class Item_func_from_days :public Item_date
const char *func_name() const { return "from_days"; } const char *func_name() const { return "from_days"; }
bool get_date(MYSQL_TIME *res, uint fuzzy_date); bool get_date(MYSQL_TIME *res, uint fuzzy_date);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return has_date_args() || has_time_args(); return has_date_args() || has_time_args();
} }
...@@ -767,7 +767,7 @@ class Item_extract :public Item_int_func ...@@ -767,7 +767,7 @@ class Item_extract :public Item_int_func
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
virtual void print(String *str, enum_query_type query_type); virtual void print(String *str, enum_query_type query_type);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
switch (int_type) { switch (int_type) {
case INTERVAL_YEAR: case INTERVAL_YEAR:
...@@ -1053,7 +1053,7 @@ class Item_func_microsecond :public Item_int_func ...@@ -1053,7 +1053,7 @@ class Item_func_microsecond :public Item_int_func
maybe_null=1; maybe_null=1;
} }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool is_arguments_valid_processor(uchar *int_arg) bool check_valid_arguments_processor(uchar *int_arg)
{ {
return !has_time_args(); return !has_time_args();
} }
......
...@@ -1014,12 +1014,13 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, ...@@ -1014,12 +1014,13 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
} }
/* /*
We don't allow creating partitions with timezone-dependent expressions as We don't allow creating partitions with expressions with non matching
a (sub)partitioning function, but we want to allow such expressions when arguments as a (sub)partitioning function,
opening existing tables for easier maintenance. This exception should be but we want to allow such expressions when opening existing tables for
deprecated at some point in future so that we always throw an error. easier maintenance. This exception should be deprecated at some point
in future so that we always throw an error.
*/ */
if (func_expr->walk(&Item::is_arguments_valid_processor, if (func_expr->walk(&Item::check_valid_arguments_processor,
0, NULL)) 0, NULL))
{ {
if (is_create_table_ind) if (is_create_table_ind)
......
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