Bug #34562 CAST does not accept standard-sql numeric types
Submitted: 14 Feb 2008 18:55 Modified: 22 Feb 2008 18:53
Reporter: Ken Johanson Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.1.22-rc-log OS:Any
Assigned to: CPU Architecture:Any

[14 Feb 2008 18:55] Ken Johanson
The CAST function does not accept ansi/iso standard numeric-types (cast from char):

SELECT CAST('123' AS INTEGER) (spec defines as implict signed) -> Error
SELECT CAST('123' AS SIGNED INTEGER) -> 123 (signed-ness not in sql spec)

In addition to INTEGER, SMALLINT and BIGINT do not work.

How to repeat:
[14 Feb 2008 19:56] Valeriy Kravchuk
Thank you for a problem report. As current set of types supported is explicitely described in the manual, http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html#function_cast, (whatever the reason is for having it) this is a reasonable and high-priority feature request, but not a bug, formally.
[14 Feb 2008 22:26] Ken Johanson
I must plea for changing this back to a bug. I feel that sql non-conformace is very much a bug, especially on a *essential* and basic function like CAST, and because there is no portable way to return these standard data-types in Mysql right now. All the other database implement this cast corrrectly.
[22 Feb 2008 18:39] Trudy Pelzer
While I agree that this is functionality we would like 
MySQL to support, the fact remains that -- since CAST 
currently has limited support by intent (as evidenced
in the Reference Manual) -- this is a feature request 
and not a bug.
[22 Feb 2008 18:53] Ken Johanson
"limited support by intent" for a base-level SQL standard??? And one if implemented that should cause no negative impact (breaking apps etc)? 

Not only did you change from D4 (Minor) to D5 (Feature request), you also changed the target version from 6.0 to none??? This is fodder so many mailing lists.