diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-11-02 09:21:39 -0200 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-11-02 09:21:39 -0200 |
commit | 1ca80ed19e14d8d5837fa900ad75ec1a7a7856e1 (patch) | |
tree | bb35488e2d55c68d42dd179686f0b5b6949f7055 /sql/item.cc | |
parent | cd167ee2e9dd4b2e51b0df426542f71c4daa4a02 (diff) | |
download | mariadb-git-1ca80ed19e14d8d5837fa900ad75ec1a7a7856e1.tar.gz |
Bug#48370: Absolutely wrong calculations with GROUP BY and decimal fields when using IF
Bug#45261: Crash, stored procedure + decimal
Revert fix for Bug#45261 due to unforeseen bugs.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/sql/item.cc b/sql/item.cc index 5bace670e9b..8f487872f1b 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -435,26 +435,17 @@ Item::Item(THD *thd, Item *item): } -/** - Decimal precision of the item. - - @remark The precision must not be capped as it can be used in conjunction - with Item::decimals to determine the size of the integer part when - constructing a decimal data type. - - @see Item::decimal_int_part() - @see Item::decimals -*/ - uint Item::decimal_precision() const { - uint precision= max_length; Item_result restype= result_type(); if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT)) - precision= my_decimal_length_to_precision(max_length, decimals, unsigned_flag); - - return precision; + { + uint prec= + my_decimal_length_to_precision(max_length, decimals, unsigned_flag); + return min(prec, DECIMAL_MAX_PRECISION); + } + return min(max_length, DECIMAL_MAX_PRECISION); } @@ -4908,7 +4899,9 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) switch (field_type()) { case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_NEWDECIMAL: - field= Field_new_decimal::new_decimal_field(this); + field= new Field_new_decimal((uchar*) 0, max_length, null_ptr, 0, + Field::NONE, name, decimals, 0, + unsigned_flag); break; case MYSQL_TYPE_TINY: field= new Field_tiny((uchar*) 0, max_length, null_ptr, 0, Field::NONE, |