Description:
Output:
=====
mysql> select cast( coalesce( date '2015-01-01', timestamp '2016-01-01 01:01:01') as decimal ), cast( cast( date '2015-01-01' as datetime) as decimal );
+----------------------------------------------------------------------------------+---------------------------------------------------------+
| cast( coalesce( date '2015-01-01', timestamp '2016-01-01 01:01:01') as decimal ) | cast( cast( date '2015-01-01' as datetime) as decimal ) |
+----------------------------------------------------------------------------------+---------------------------------------------------------+
| 20150101 | 9999999999 |
+----------------------------------------------------------------------------------+---------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.8-rc |
+-----------+
1 row in set (0.00 sec)
Problem:
=====
"cast( coalesce( date '2015-01-01', timestamp '2016-01-01 01:01:01') as decimal )" is expected to return 9999999999.
How to repeat:
select cast( coalesce( date '2015-01-01', timestamp '2016-01-01 01:01:01') as decimal ), cast( cast( date '2015-01-01' as datetime) as decimal );
Suggested fix:
"cast( coalesce( date '2015-01-01', timestamp '2016-01-01 01:01:01') as decimal )" returns 9999999999.