summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-12-24 15:05:52 +0400
committerAlexander Barkov <bar@mariadb.com>2019-12-24 15:05:52 +0400
commit3dfe1ba3b85043ed3c451292c6a47950849569dd (patch)
treeccce84c930105a575e9b5f43d559909f6994df64 /sql/item_timefunc.h
parentcbc170adf2a0a6379591965c38d75e2d5af2c506 (diff)
downloadmariadb-git-3dfe1ba3b85043ed3c451292c6a47950849569dd.tar.gz
MDEV-21388 Wrong result of DAYNAME()=xxx in combination with condition_pushdown_for_derived=on
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h25
1 files changed, 10 insertions, 15 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index e37438947dd..c89b6921796 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -410,26 +410,17 @@ public:
};
-class Item_func_weekday :public Item_func
+class Item_func_weekday :public Item_int_func
{
bool odbc_type;
public:
Item_func_weekday(THD *thd, Item *a, bool type_arg):
- Item_func(thd, a), odbc_type(type_arg) { collation.set_numeric(); }
+ Item_int_func(thd, a), odbc_type(type_arg) { }
longlong val_int();
- double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
- String *val_str(String *str)
- {
- DBUG_ASSERT(fixed == 1);
- str->set(val_int(), &my_charset_bin);
- return null_value ? 0 : str;
- }
const char *func_name() const
{
return (odbc_type ? "dayofweek" : "weekday");
}
- enum Item_result result_type () const { return INT_RESULT; }
- enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
bool fix_length_and_dec()
{
decimals= 0;
@@ -447,21 +438,25 @@ public:
{ return get_item_copy<Item_func_weekday>(thd, mem_root, this); }
};
-class Item_func_dayname :public Item_func_weekday
+class Item_func_dayname :public Item_str_func
{
MY_LOCALE *locale;
public:
- Item_func_dayname(THD *thd, Item *a): Item_func_weekday(thd, a, 0) {}
+ Item_func_dayname(THD *thd, Item *a): Item_str_func(thd, a) {}
const char *func_name() const { return "dayname"; }
String *val_str(String *str);
- enum Item_result result_type () const { return STRING_RESULT; }
- enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
bool fix_length_and_dec();
bool check_partition_func_processor(void *int_arg) {return TRUE;}
bool check_vcol_func_processor(void *arg)
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
+ bool check_valid_arguments_processor(void *int_arg)
+ {
+ return !has_date_args();
+ }
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_dayname>(thd, mem_root, this); }
};