[MDEV-31280] Inconsistent query results with datetime columns and indexes Created: 2023-05-15 Updated: 2023-11-28 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Update |
| Affects Version/s: | 10.4, 10.3.38, 10.5.19, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11 |
| Fix Version/s: | 10.4, 10.5, 10.6, 10.11 |
| Type: | Bug | Priority: | Major |
| Reporter: | Justin Pasher | Assignee: | Sergei Golubchik |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian Buster and Debian Bullseye |
||
| Description |
|
There appears to be inconsistent results from queries using a datetime column depending on whether the column has an index (both regular and UNIQUE index act the same). See the following sample (run under 10.3.38 and 10.5.19)
This issues a warning due to the unsupported 'Z' in the datetime, but the query still inserts the data. If sql_mode is left as the default, the query errors out.
If we try to update the row using the same datetime format, instead of the data getting updated and receiving a warning, nothing changes, and there are no warnings.
If we drop the index on the starttime column and then try to update, the data will change, and we receive a warning.
There's something weird going on with the implicit casting of the string to datetime format when an index is present. As a bonus, if you explicitly cast the string beforehand, it will work even with the index.
|