Bug #13557 select 0.00 as fd_name,... return a char instead a float
Submitted: 28 Sep 2005 9:39 Modified: 21 May 2006 9:39
Reporter: Marino Crescimanno Email Updates:
Status: Can't repeat Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.13rc OS:Windows (WinXP)
Assigned to: CPU Architecture:Any

[28 Sep 2005 9:39] Marino Crescimanno
select 0.00 as fd_name,....
from t1

return fd_name as char type instead the expected float field, like previous server did.

A cast is needed to obtain the expected type: 
select CAST(0.00 as UNSIGNED) as fd_name,,....
from t1

How to repeat:
write a select statement from any query tool.

select 0.00 as fd_float,anytable.* from anytable

I expect 

fd_float  fd1  fd2 ... fdx

0.00       d1   d2      dx           0.00 is of type char
[28 Sep 2005 9:54] Vasily Kishkin
Thanks for the bug report. I was able to reproduce the bug:

mysql> select 0.01 as float_value_must_be from tl;
| float_value_must_be |
| 0.01                |
1 row in set (0.00 sec)

mysql> select 0 as int_value_must_be from tl;
| int_value_must_be |
|                 0 |
1 row in set (0.00 sec)
[30 Sep 2005 18:00] Sergei Golubchik
What do you mean "return fd_name as char type" ? It returns the value as decimal type.
(more precisely, MYSQL_TYPE_NEWDECIMAL)
[1 Nov 2005 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[21 May 2006 9:39] Valeriy Kravchuk
0.00 is returned as DECIMAL(3,2), just as expected. Please, check with a newer version, 5.0.21:

CREATE VIEW v1 AS SELECT 0.00 decimal_field;
DESC v1;