diff options
author | unknown <sergefp@mysql.com> | 2008-04-22 02:53:12 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2008-04-22 02:53:12 +0400 |
commit | 1c1f0a62e1f68fd39ae7440042699faaffaaf7fe (patch) | |
tree | e5731dbb1c3fa541cf9f122d7dc755c25dcbec9b /sql | |
parent | 6edab4bc081b29894f3eaf70468d989ea956ff18 (diff) | |
download | mariadb-git-1c1f0a62e1f68fd39ae7440042699faaffaaf7fe.tar.gz |
BUG#36139 "float, zerofill, crash with subquery"
- Make convert_zerofill_number_to_string() take into account that the
constant it is converting may evaluate to NULL.
mysql-test/r/subselect.result:
BUG#36139 "float, zerofill, crash with subquery"
- Testcase
mysql-test/t/subselect.test:
BUG#36139 "float, zerofill, crash with subquery"
- Testcase
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc index 553ba1b152c..9ff1f8c0084 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4156,9 +4156,14 @@ static void convert_zerofill_number_to_string(Item **item, Field_num *field) String tmp(buff,sizeof(buff), field->charset()), *res; res= (*item)->val_str(&tmp); - field->prepend_zeros(res); - pos= (char *) sql_strmake (res->ptr(), res->length()); - *item= new Item_string(pos, res->length(), field->charset()); + if ((*item)->is_null()) + *item= new Item_null(); + else + { + field->prepend_zeros(res); + pos= (char *) sql_strmake (res->ptr(), res->length()); + *item= new Item_string(pos, res->length(), field->charset()); + } } |