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

Datetime string literal parsing mistreat separator . as FSP delimiter #20507

Closed
ichn-hu opened this issue Oct 19, 2020 · 9 comments · Fixed by #20534
Closed

Datetime string literal parsing mistreat separator . as FSP delimiter #20507

ichn-hu opened this issue Oct 19, 2020 · 9 comments · Fixed by #20534
Assignees
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@ichn-hu
Copy link
Contributor

ichn-hu commented Oct 19, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `t` (
  `dt` datetime DEFAULT NULL,
  `ts` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into t values ('2020.10.10 10.10.10', '2020.10.10 10.10.10');

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

On MySQL:

mysql> select * from t;
+---------------------+---------------------+
| dt                  | ts                  |
+---------------------+---------------------+
| 2020-10-10 10:10:10 | 2020-10-10 10:10:10 |
+---------------------+---------------------+

3. What did you see instead (Required)

On TiDB:

mysql> select * from t;
+---------------------+---------------------+
| dt                  | ts                  |
+---------------------+---------------------+
| 2020-10-10 10:10:00 | 2020-10-10 10:10:00 |
+---------------------+---------------------+
1 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

Could reproduce on master, 4.0 & 3.0

mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                                    |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v4.0.0-beta.2-1393-g106b04dda-dirty
Edition: Community
Git Commit Hash: 106b04ddab7b5aabc42a58f5136565a8c7efb7a5
Git Branch: master
UTC Build Time: 2020-10-19 07:22:01
GoVersion: go1.15.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@ichn-hu ichn-hu added the type/bug The issue is confirmed as a bug. label Oct 19, 2020
@ichn-hu
Copy link
Contributor Author

ichn-hu commented Oct 19, 2020

/label sig/execution

@ti-srebot
Copy link
Contributor

These labels are not found sig-execution.

@ichn-hu
Copy link
Contributor Author

ichn-hu commented Oct 19, 2020

/label sig/execution

@ti-srebot ti-srebot added the sig/execution SIG execution label Oct 19, 2020
@ichn-hu
Copy link
Contributor Author

ichn-hu commented Oct 19, 2020

I found this bug while working on #20348 , could fix it together.

@ichn-hu
Copy link
Contributor Author

ichn-hu commented Oct 19, 2020

for more information, quoted from https://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html

A trailing fractional seconds part is recognized in the 'D hh:mm:ss.fraction', 'hh:mm:ss.fraction', 'hhmmss.fraction', and hhmmss.fraction time formats, where fraction is the fractional part in up to microseconds (6 digits) precision. The fractional part should always be separated from the rest of the time by a decimal point; no other fractional seconds delimiter is recognized.

Therefore, this seemingly ambiguous case is acutally specified that MySQL won't accept hh:mm.fraction.

@ichn-hu ichn-hu changed the title Datetime string literal parsing mistreat seperator . as FSP delimiter Datetime string literal parsing mistreat separator . as FSP delimiter Oct 22, 2020
@ichn-hu
Copy link
Contributor Author

ichn-hu commented Oct 22, 2020

/assign @ichn-hu

@seiya-annie
Copy link

/info

@ti-srebot
Copy link
Contributor

ti-srebot commented Oct 28, 2020

Please edit this comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

@ti-srebot
Copy link
Contributor

( FixedVersions AffectedVersions ) fields are empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
5 participants