Commit 9b88d252 authored by hf@deer.(none)'s avatar hf@deer.(none)

additional fix to the bug #13372 (decimal union)

parent 7f3e2dc4
...@@ -247,6 +247,6 @@ d ...@@ -247,6 +247,6 @@ d
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`d` double(61,9) default NULL `d` double(22,9) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2, t3; drop table t1, t2, t3;
...@@ -3230,12 +3230,12 @@ bool Item_type_holder::join_types(THD *thd, Item *item) ...@@ -3230,12 +3230,12 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
} }
case REAL_RESULT: case REAL_RESULT:
{ {
decimals= max(decimals, item->decimals);
if (decimals != NOT_FIXED_DEC) if (decimals != NOT_FIXED_DEC)
{ {
int delta1= max_length_orig - decimals_orig; int delta1= max_length_orig - decimals_orig;
int delta2= item->max_length - item->decimals; int delta2= item->max_length - item->decimals;
max_length= max(delta1, delta2) + decimals; max_length= min(max(delta1, delta2) + decimals,
(fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7);
} }
else else
max_length= (fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7; max_length= (fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment