Bug #115176 | Inconsistent Results When Using Date and FROM_DAYS Conversion | ||
---|---|---|---|
Submitted: | 30 May 13:41 | Modified: | 30 May 14:25 |
Reporter: | Wenqian Deng | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[30 May 13:41]
Wenqian Deng
[30 May 14:13]
MySQL Verification Team
Hello Wenqian Deng, Thank you for the report and test case. Verified as described. regards, Umesh
[30 May 14:14]
MySQL Verification Team
Hi Mr. Deng, Thank you for your bug report. However, this is not a bug. These are our results: c_1 (FROM_DAYS(c_0)) 6054-10-18 6054-10-18 First query Second query Both returned empty results ....... We have your two queries differently. We just replaced a date function with FROM_DAYS conversion. The rest remained the same.
[30 May 14:25]
Wenqian Deng
I am sure these sqls provided returns different results on MySQL 8.0. see: https://dbfiddle.uk/NLvo8qJf
[30 May 14:27]
MySQL Verification Team
Hi Mr. Deng, Actually, we found the error in your queries ........ You have used the following condition: BETWEEN '9827-01-06 04:56:45.000000' AND 1477699892 If you mix different data types, you will get very inconsistent results. In this case, you mixed DATETIME type and an integer. SQL Standard is clear that an error should be returned straightforward. However, MySQL tries to do more ....... so in this expression that uses three values, it tried to find a common denominator. When we have removed that condition, we got the correct result: c_1 (FROM_DAYS(c_0)) 6054-10-18 6054-10-18 First query c_1 6054-10-18 Second query FROM_DAYS(t0.c_0) 6054-10-18 Not a bug.