diff options
author | Georgi Kodinov <joro@sun.com> | 2009-11-20 12:10:47 +0200 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2009-11-20 12:10:47 +0200 |
commit | a21cd97c3506a70297afc3dd3f64cdfd2dc0a4e6 (patch) | |
tree | 6dd67d2e2233b91b60411032a36b63de5922949d /sql/item.cc | |
parent | fad34c34cf22eb1c503204aee204dfb83ad7acea (diff) | |
download | mariadb-git-a21cd97c3506a70297afc3dd3f64cdfd2dc0a4e6.tar.gz |
Bug #45261 : Crash, stored procedure + decimal
Bug #48370 Absolutely wrong calculations with GROUP BY and
decimal fields when using IF
Added the test cases in the above two bugs for regression
testing.
Added additional tests that demonstrate a incomplete fix.
Added a new factory method for Field_new_decimal to
create a field from an (decimal returning) Item.
In the new method made sure that all the precision and
length variables are capped in a proper way.
This is required because Item's can have larger precision
than the decimal fields and thus need to be capped when
creating a field based on an Item type.
Fixed the wrong typecast to Item_decimal.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc index e1dbc1ba21a..ab70996e541 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4899,9 +4899,7 @@ 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= new Field_new_decimal((uchar*) 0, max_length, null_ptr, 0, - Field::NONE, name, decimals, 0, - unsigned_flag); + field= Field_new_decimal::create_from_item(this); break; case MYSQL_TYPE_TINY: field= new Field_tiny((uchar*) 0, max_length, null_ptr, 0, Field::NONE, |