summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2020-06-01 10:35:01 +0400
committerAlexander Barkov <bar@mariadb.com>2020-06-01 10:35:01 +0400
commit35cbbd4d70e300d25077ece1971c9f7266f347e9 (patch)
tree56da16d18bebf1c64b43cd87f33d79c747ee2df4 /sql/item_timefunc.cc
parentf67522ede66bfccb90d80f4f3e41209997862fef (diff)
downloadmariadb-git-35cbbd4d70e300d25077ece1971c9f7266f347e9.tar.gz
MDEV-20809 EXTRACT from INET6 value does not produce any warnings
Disallowing EXTRACT(xxx FROM inet6arg) as fix time. Adding a new method Type_handler::can_return_extract_source().
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index a1377af08e6..e47d4fa7f0e 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2109,6 +2109,21 @@ void Item_extract::print(String *str, enum_query_type query_type)
str->append(')');
}
+
+bool Item_extract::check_arguments() const
+{
+ if (!args[0]->type_handler()->can_return_extract_source(int_type))
+ {
+ char tmp[64];
+ my_snprintf(tmp, sizeof(tmp), "extract(%s)", interval_names[int_type]);
+ my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
+ args[0]->type_handler()->name().ptr(), tmp);
+ return true;
+ }
+ return false;
+}
+
+
bool Item_extract::fix_length_and_dec()
{
maybe_null=1; // If wrong date