Bug #30524 CAST(0 AS Double) needed
Submitted: 20 Aug 2007 22:24 Modified: 20 Aug 2007 22:45
Reporter: Mark Callaghan Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Data Types Severity:S4 (Feature request)
Version:5.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: cast, double, literal, numeric
Triage: Triaged: D5 (Feature request)

[20 Aug 2007 22:24] Mark Callaghan
Numeric literals have type Double in MySQL 4 and type Decimal in MySQL 5. In some cases, the semantics of Double are preferred over Decimal. Adding support for Double to the Cast function makes it easier for expressions to continue to use Double.

How to repeat:
create table t as select 0.00;
insert into t 99.99;
select * from t;

Note, that the precision for the Decimal column (when using MySQL5) in t is Decimal(3,2). Values inserted into this table will be truncated by MySQL5, but not by MySQL4.

desc t;

Suggested fix:
Support: create table t as select Cast(0 as Double)
[20 Aug 2007 22:45] Miguel Solorzano
Thank you for the bug report.