| Bug #121217 | YEAR column is temporalized while YEAR numeric constants are not: opposite answers per context | ||
|---|---|---|---|
| Submitted: | 3 Sep 7:30 | Modified: | 3 Sep 11:55 |
| Reporter: | Chunling Qin | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
| Version: | 9.7.2 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[3 Sep 7:30]
Chunling Qin
[3 Sep 11:55]
Roy Lyseng
Thank you for the bug report. However, this is not a bug. The two cases are distinct. The first statement carries out an operation in TIME comparison context, and the second in a DATE comparison context, since there is no way to distinguish 2024 (the year) from 2024 (the integer). Thus, we attempt to convert 2024 to a TIME, resp. a DATE value, before the comparison takes place. The last statement involves a year column, which takes priority. We therefore convert TIME'00:00:01' to a year by adding the current date and extracting the year, and for DATE'2024-01-01' we simply extract the year, before carrying out the comparison.
