summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-08-09 11:08:11 +0400
committerAlexander Barkov <bar@mariadb.com>2018-08-09 11:08:11 +0400
commitffdae1a960330ed86c83125792cffb8093d25410 (patch)
tree9c181e7339cf13fe0ebc88269736db8c82900457 /sql/field.h
parent3f01c4fbd4c99adaf9d3277bea8542755047ead4 (diff)
downloadmariadb-git-ffdae1a960330ed86c83125792cffb8093d25410.tar.gz
MDEV-16926 CAST(COALESCE(year_field)) returns wrong value
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/field.h b/sql/field.h
index 909ee218f71..2b2dd88ab17 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -2881,7 +2881,10 @@ public:
:Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, 1, 1)
{}
- const Type_handler *type_handler() const { return &type_handler_year; }
+ const Type_handler *type_handler() const
+ {
+ return field_length == 2 ? &type_handler_year2 : &type_handler_year;
+ }
Copy_func *get_copy_func(const Field *from) const
{
if (eq_def(from))