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
commit966d0ebaf3672458056c6de32da429d50b3f76d9 (patch)
treea5acc440e05f371151bbdafd9bb22854c105ff7d /sql/item_func.h
parentc676f125a216d29660fff88b0c3dee947d3904d9 (diff)
downloadmariadb-git-966d0ebaf3672458056c6de32da429d50b3f76d9.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).
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();
}