mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 08:44:33 +01:00
MDEV-26691 SFORMAT: Pass down FLOAT as FLOAT, without upcast to DOUBLE
This commit is contained in:
parent
284ed64336
commit
6a7c10de92
3 changed files with 16 additions and 1 deletions
|
@ -449,3 +449,9 @@ sformat("={:d}=", ?)
|
|||
NULL
|
||||
Warnings:
|
||||
Warning 4183 SFORMAT error: invalid type specifier
|
||||
#
|
||||
# MDEV-26691 SFORMAT: Pass down FLOAT as FLOAT, without upcast to DOUBLE
|
||||
#
|
||||
select sformat('{}', cast(1.1 as float));
|
||||
sformat('{}', cast(1.1 as float))
|
||||
1.1
|
||||
|
|
|
@ -207,3 +207,9 @@ echo #;
|
|||
prepare s from 'select sformat("={:d}=", ?)';
|
||||
execute s using 100;
|
||||
execute s using 'abc';
|
||||
|
||||
echo #;
|
||||
echo # MDEV-26691 SFORMAT: Pass down FLOAT as FLOAT, without upcast to DOUBLE;
|
||||
echo #;
|
||||
|
||||
select sformat('{}', cast(1.1 as float));
|
||||
|
|
|
@ -1393,7 +1393,10 @@ String *Item_func_sformat::val_str(String *res)
|
|||
break;
|
||||
case DECIMAL_RESULT: // TODO
|
||||
case REAL_RESULT:
|
||||
vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_real());
|
||||
if (args[carg]->field_type() == MYSQL_TYPE_FLOAT)
|
||||
vargs[carg-1]= fmt::detail::make_arg<ctx>((float)args[carg]->val_real());
|
||||
else
|
||||
vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_real());
|
||||
break;
|
||||
case STRING_RESULT:
|
||||
if (!(parg= args[carg]->val_str(&val_arg[carg-1])))
|
||||
|
|
Loading…
Add table
Reference in a new issue