1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Bug #28492: subselect returns LONG in >5.0.24a and LONGLONG in <=5.0.24a

Integer values with 10 digits may or may not fit into an int column 
(e.g. 2147483647 vs 6147483647).
Thus when creating a temp table column for such an int we must
use bigint instead.
Fixed to use bigint.
Also subsituted a "magic number" with a named constant.
This commit is contained in:
gkodinov/kgeorge@magare.gmz
2007-05-30 09:55:38 +03:00
parent 48fe280271
commit a5b04a3ba9
8 changed files with 46 additions and 19 deletions

View File

@ -8869,8 +8869,13 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
item->name, table, item->decimals, TRUE);
break;
case INT_RESULT:
/* Select an integer type with the minimal fit precision */
if (item->max_length > MY_INT32_NUM_DECIMAL_DIGITS)
/*
Select an integer type with the minimal fit precision.
MY_INT32_NUM_DECIMAL_DIGITS is sign inclusive, don't consider the sign.
Values with MY_INT32_NUM_DECIMAL_DIGITS digits may or may not fit into
Field_long : make them Field_longlong.
*/
if (item->max_length >= (MY_INT32_NUM_DECIMAL_DIGITS - 1))
new_field=new Field_longlong(item->max_length, maybe_null,
item->name, table, item->unsigned_flag);
else