Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 10.0.8, 10.1
-
Fix Version/s: 10.1.8
-
Component/s: Temporal Types
-
Labels:
-
Sprint:10.1.8-4
Description
GREATEST and COALESCE return different data types
for a combination of TIME and DATE parameters:
mysql> SELECT GREATEST(CURRENT_TIME, CURRENT_DATE), COALESCE(CURRENT_TIME, CURRENT_DATE); +--------------------------------------+--------------------------------------+ | GREATEST(CURRENT_TIME, CURRENT_DATE) | COALESCE(CURRENT_TIME, CURRENT_DATE) | +--------------------------------------+--------------------------------------+ | 838:59:59 | 0000-00-00 16:24:54 | +--------------------------------------+--------------------------------------+ 1 row in set, 1 warning (0.00 sec) mysql> show warnings; +---------+------+----------------------------------------------+ | Level | Code | Message | +---------+------+----------------------------------------------+ | Warning | 1292 | Truncated incorrect time value: '1944:00:00' | +---------+------+----------------------------------------------+ 1 row in set (0.00 sec)
GREATEST returns TIME, which looks wrong.
COALESCE return DATETIME, which looks more correct.
(DATETIME is a minumal common type for DATE and TIME).
GREATEST should be fixed to return DATETIME as well.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
MySQL-5.7.8 is not affected.