Bug #27542 | CAST() Function to Integer(10) | ||
---|---|---|---|
Submitted: | 30 Mar 2007 9:08 | Modified: | 26 Apr 2007 11:25 |
Reporter: | Paul van Keulen | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Server | Severity: | S4 (Feature request) |
Version: | 5.0.24 | OS: | Any (2.6.17-gentoo-r8-va) |
Assigned to: | CPU Architecture: | Any | |
Tags: | CAST(), INT(10) |
[30 Mar 2007 9:08]
Paul van Keulen
[26 Apr 2007 11:25]
Valeriy Kravchuk
Please, use SIGNED [INTEGER] or UNSIGNED type to cast: mysql> select cast(null as signed) a; +------+ | a | +------+ | NULL | +------+ 1 row in set (0.00 sec) mysql> select cast(null as unsigned) a; +------+ | a | +------+ | NULL | +------+ 1 row in set (0.00 sec) http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html
[2 Dec 2008 18:59]
matthew montgomery
UNSIGNED is still not good enough, we need to be able to cast to all integral types. if you actually read the post, COUNT is returning int64 (UNSIGNED OR SIGNED) and c# applications expect an Int32...and throw an invalid cast exception when trying to unbox an object returned from COUNT() to type (int).