Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time: insert item lost the fraction when encountering time string with timezone suffix #35291

Closed
AilinKid opened this issue Jun 10, 2022 · 0 comments · Fixed by #37820
Closed
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@AilinKid
Copy link
Contributor

AilinKid commented Jun 10, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

DROP TABLE IF EXISTS `testSetObjectTime`;
CREATE TABLE `testSetObjectTime` (
  `id` int(11) DEFAULT NULL,
  `d` time(6) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
INSERT INTO testSetObjectTime VALUES (1, '2020-01-01 12:00:00.123456000+05:00');
INSERT INTO testSetObjectTime VALUES (2, '2020-01-01 12:00:00.123456+05:00');
SELECT * FROM testSetObjectTime;

2. What did you expect to see? (Required)

MySQL has its warnings as Incorrect time value: '2020-01-01 12:00:00.123456+05:00' for column 'd' at row 1
So it won't recognize the timezone suffix and convert the 12:00:00.123456 to its default UTC timezone as 07:00:00.123456

But TiDB will convert the 12:00:00.123456 (from source +5:00, yes we recognized it and used it as source time zone) to its default Asia/Shanghai timezone (+8:00) as 15:00:00.123456, but unfortunately, we lost the fraction here.

+------+-----------------+
| id   | d               |
+------+-----------------+
|    1 | 15:00:00.123456 |
|    2 | 15:00:00.123456 |
+------+-----------------+

3. What did you see instead (Required)

+------+-----------------+
| id   | d               |
+------+-----------------+
|    1 | 15:00:00.000000 |
|    2 | 15:00:00.000000 |
+------+-----------------+

4. What is your TiDB version? (Required)

master

@AilinKid AilinKid added the type/bug The issue is confirmed as a bug. label Jun 10, 2022
@ChenPeng2013 ChenPeng2013 added sig/execution SIG execution severity/major affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. labels Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants