|
When I have a DATE(TIME) column as a PK (or part of PK) and I try to SELECT a specific row using a datetime string which contains a timezone part, a warning is issued for "truncated incorrect datetime value" and the row is found.
When I try to do an UPDATE with the same WHERE condition, I get no warning, no error and the row is not updated.
When the column is not the PK, the UPDATE throws an error instead of silently ignoring it.
https://dbfiddle.uk/?rdbms=mariadb_10.3&fiddle=eee4fdbc49ec5abbe708e64e36c32848
https://dbfiddle.uk/?rdbms=mariadb_10.3&fiddle=8b72eedd6f43b794ed6edf9bc8740265
MySQL 5.6 seems to work without errors in http://sqlfiddle.com/#!9/9cffea/1 and https://www.db-fiddle.com/f/fA8ZG3px1XQdd8ANxCt6Xp/0
MySQL 5.7 and 8.0 on the other hand throw the error even when the column is the PK - https://www.db-fiddle.com/f/fA8ZG3px1XQdd8ANxCt6Xp/1.
|