Bug #87737 | 'addtime' acts inconsistently when the second parameter a 'datetime' value | ||
---|---|---|---|
Submitted: | 12 Sep 2017 12:41 | Modified: | 12 Oct 2017 1:14 |
Reporter: | Chuan Du | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
Version: | 5.7.17 | OS: | MacOS |
Assigned to: | MySQL Verification Team | CPU Architecture: | Any |
[12 Sep 2017 12:41]
Chuan Du
[7 Oct 2017 0:30]
MySQL Verification Team
Hi, I do not agree this is a bug, as you wrote yourself manual clearly states that "... and expr2 is a time expression" and datetime is not a time expression. mysql [localhost] {msandbox} (test) > select addtime(a, a) from t; +---------------+ | addtime(a, a) | +---------------+ | NULL | +---------------+ 1 row in set (0.01 sec) mysql [localhost] {msandbox} (test) > select addtime(a, time(a)) from t; +---------------------+ | addtime(a, time(a)) | +---------------------+ | 2017-01-01 02:02:02 | +---------------------+ 1 row in set (0.00 sec) so mysql is behaving as expected kind regards Bogdan
[12 Oct 2017 1:14]
Chuan Du
Hi, Bogdan: Thanks for your reply. There's still something I think is not right. The result of expression 'cast('2017-01-01 01:01:01' as datetime)' is of 'DATETIME' type, not 'TIME', so according to the manual, I think 'select addtime(a, cast('2017-01-01 01:01:01' as datetime)) from t;' should return 'NULL', do you agree? mysql> select addtime(a, cast('2017-01-01 01:01:01' as datetime)) from t; +-----------------------------------------------------+ | addtime(a, cast('2017-01-01 01:01:01' as datetime)) | +-----------------------------------------------------+ | 2017-01-01 02:02:02 | +-----------------------------------------------------+ 1 row in set (0.00 sec)