[MDEV-17656] Inconsistent handling of datetime literals containing a timezone Created: 2018-11-09  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Temporal Types
Affects Version/s: 5.5, 10.0, 10.1, 10.2.18, 10.3.9, 10.2, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Jiri Kavalik Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File mariadb_date_inconsistent.sql    

 Description   

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.



 Comments   
Comment by Elena Stepanova [ 2018-11-11 ]

Thanks for the report and test case. Reproducible as described.

Generated at Thu Feb 08 08:38:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.