summaryrefslogtreecommitdiff
path: root/sql/item_func.h
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2010-12-22 10:50:36 +0100
committerMattias Jonsson <mattias.jonsson@oracle.com>2010-12-22 10:50:36 +0100
commit1615419d7265ccc76db6fbe667651f2dce345ca8 (patch)
treea5acc440e05f371151bbdafd9bb22854c105ff7d /sql/item_func.h
parent1a3d5fbfc7aa45463354b57586e24a630727c73e (diff)
downloadmariadb-git-1615419d7265ccc76db6fbe667651f2dce345ca8.tar.gz
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 There were functions allowed as partitioning functions that implicit allowed cast. That could result in unacceptable behaviour. Solution was to check that the arguments of date and time functions have allowed types (field and date/datetime/time depending on function). mysql-test/r/partition.result: Updated result mysql-test/r/partition_error.result: Updated result mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc: disabled test with not allowed arguments. mysql-test/suite/parts/r/part_supported_sql_func_innodb.result: Updated result mysql-test/suite/parts/r/part_supported_sql_func_myisam.result: Updated result mysql-test/t/partition.test: Fixed typo in bug number and removed non allowed function (bad argument) mysql-test/t/partition_error.test: Added tests to verify correct type of argument. sql/item.h: Renamed processor since it is no longer only for timezone sql/item_func.h: Added help functions for checking date/time/datetime arguments. sql/item_timefunc.h: Added processors for argument correctness sql/sql_partition.cc: renamed the processor for checking arguments.
Diffstat (limited to 'sql/item_func.h')
-rw-r--r--sql/item_func.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/sql/item_func.h b/sql/item_func.h
index 26a7e033692..176e3dc4d44 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -189,6 +189,7 @@ public:
null_value=1;
return 0.0;
}
+
bool has_timestamp_args()
{
DBUG_ASSERT(fixed == TRUE);
@@ -200,6 +201,45 @@ public:
}
return FALSE;
}
+
+ bool has_date_args()
+ {
+ DBUG_ASSERT(fixed == TRUE);
+ for (uint i= 0; i < arg_count; i++)
+ {
+ if (args[i]->type() == Item::FIELD_ITEM &&
+ (args[i]->field_type() == MYSQL_TYPE_DATE ||
+ args[i]->field_type() == MYSQL_TYPE_DATETIME))
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ bool has_time_args()
+ {
+ DBUG_ASSERT(fixed == TRUE);
+ for (uint i= 0; i < arg_count; i++)
+ {
+ if (args[i]->type() == Item::FIELD_ITEM &&
+ (args[i]->field_type() == MYSQL_TYPE_TIME ||
+ args[i]->field_type() == MYSQL_TYPE_DATETIME))
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ bool has_datetime_args()
+ {
+ DBUG_ASSERT(fixed == TRUE);
+ for (uint i= 0; i < arg_count; i++)
+ {
+ if (args[i]->type() == Item::FIELD_ITEM &&
+ args[i]->field_type() == MYSQL_TYPE_DATETIME)
+ return TRUE;
+ }
+ return FALSE;
+ }
+
/*
We assume the result of any function that has a TIMESTAMP argument to be
timezone-dependent, since a TIMESTAMP value in both numeric and string
@@ -208,7 +248,7 @@ public:
representation of a TIMESTAMP argument verbatim, and thus does not depend on
the timezone.
*/
- virtual bool is_timezone_dependent_processor(uchar *bool_arg)
+ virtual bool is_arguments_valid_processor(uchar *bool_arg)
{
return has_timestamp_args();
}