Showing entries 1 to 1
Displaying posts with tag: cast functions (reset)
A few casting problems that show up in all MySQL versions

There are two problems with the CAST function in all versions of MySQL:

bug#43774CAST(CAST(value) as TIME as DATETIME ) returns the wrong value.

example:
mysql> select '0000-00-00 21:00:00' expected, cast(cast('21:00:00' as time) as datetime) actual;
+---------------------+---------------------+
| expected | actual |
+---------------------+---------------------+
| 0000-00-00 21:00:00 | 2021-00-00 00:00:00 |
+---------------------+---------------------+
1 row in set (0.00 sec)

bug#43865CAST( -1.0 as UNSIGNED) yields 0 instead of MAXINT and returns a warning.

example:
create table t1(c1 int signed,
c2 decimal(5,2),
c3 float(5,2)
);

insert into t1 values …

[Read more]
Showing entries 1 to 1