summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-03-15 11:36:41 +0400
committerAlexander Barkov <bar@mariadb.com>2019-03-15 11:37:29 +0400
commit78c2499282aa16b96441e293a957483bf14cfca0 (patch)
tree7c53e0c2c70adae1c0184e3e2d00c7fb5bf04d99 /sql/item.cc
parent3d2d060b626a94a19480db55feecc3020440b5c3 (diff)
downloadmariadb-git-78c2499282aa16b96441e293a957483bf14cfca0.tar.gz
MDEV-16958 Assertion `field_length < 5' failed in Field_year::val_str or data corruption upon SELECT with UNION and aggregate functions
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index d8f27bdb30e..3bfbdb75c40 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -9476,7 +9476,10 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
break;
}
default:
- max_length= MY_MAX(max_length, display_length(item));
+ if (fld_type == MYSQL_TYPE_YEAR)
+ max_length= MY_MAX(max_length, item->max_length);
+ else
+ max_length= MY_MAX(max_length, display_length(item));
};
maybe_null|= item->maybe_null;
get_full_info(item);