diff options
author | Sergey Glukhov <sergey.glukhov@oracle.com> | 2011-04-12 14:01:33 +0400 |
---|---|---|
committer | Sergey Glukhov <sergey.glukhov@oracle.com> | 2011-04-12 14:01:33 +0400 |
commit | 60cc2f91d6848ced6be1463a22d21b5b9d2c2dab (patch) | |
tree | 7e37918911232c98342c8bdd144228021fb88611 /sql/item_sum.cc | |
parent | 56bff85247cfa97aef87193792b8c321c12412fc (diff) | |
download | mariadb-git-60cc2f91d6848ced6be1463a22d21b5b9d2c2dab.tar.gz |
Bug#11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION
When we create temporary result table for UNION
incorrect max_length for YEAR field is used and
it leads to incorrect field value and incorrect
result string length as YEAR field value calculation
depends on field length.
The fix is to use underlying item max_length for
Item_sum_hybrid::max_length intialization.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 2a8aea68f7a..c62738abac0 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -612,17 +612,13 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref) switch (hybrid_type= item->result_type()) { case INT_RESULT: - max_length= 20; - break; case DECIMAL_RESULT: + case STRING_RESULT: max_length= item->max_length; break; case REAL_RESULT: max_length= float_length(decimals); break; - case STRING_RESULT: - max_length= item->max_length; - break; case ROW_RESULT: default: DBUG_ASSERT(0); |