We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please answer these questions before submitting your issue. Thanks!
create table t (dt datetime, dt6 datetime(6), ts timestamp, ts6 timestamp(6)); insert into t values (now(6), now(6), now(6), now(6)); select sleep(0.5); insert into t values (now(6), now(6), now(6), now(6)); insert into t values (now(), now(), now(), now()); select sleep(0.5); insert into t values (now(), now(), now(), now()); select * from t;
FSP to be truncated
FSP was rounded, causing issues like inserting '2022-12-31 23:59:59.501011' into a DATETIME or TIMESTAMP column results in '2023-01-01 00:00:00'.
+---------------------+----------------------------+---------------------+----------------------------+ | dt | dt6 | ts | ts6 | +---------------------+----------------------------+---------------------+----------------------------+ | 2024-10-01 17:04:39 | 2024-10-01 17:04:38.596766 | 2024-10-01 17:04:39 | 2024-10-01 17:04:38.596766 | <= Rounded UP dt and ts! | 2024-10-01 17:04:39 | 2024-10-01 17:04:39.106945 | 2024-10-01 17:04:39 | 2024-10-01 17:04:39.106945 | | 2024-10-01 17:04:39 | 2024-10-01 17:04:39.000000 | 2024-10-01 17:04:39 | 2024-10-01 17:04:39.000000 | | 2024-10-01 17:04:39 | 2024-10-01 17:04:39.000000 | 2024-10-01 17:04:39 | 2024-10-01 17:04:39.000000 | <= NOW() does truncate! +---------------------+----------------------------+---------------------+----------------------------+
tidb_version(): Release Version: v8.3.0 Edition: Community Git Commit Hash: 1a0c3ac3292fff7742faa0c00a662ccb66ba40db Git Branch: HEAD UTC Build Time: 2024-08-20 10:23:00 GoVersion: go1.21.10 Race Enabled: false Check Table Before Drop: false Store: tikv
The text was updated successfully, but these errors were encountered:
Also reported for MySQL, so at least we are MySQL compatible...
Sorry, something went wrong.
I think it is as intended :( and accordingly to MySQL Manual even in the SQL standard: https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html
@mjonss does that mean we can close this issue?
Yes, closing this, with a reference to #29406.
No branches or pull requests
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
FSP to be truncated
3. What did you see instead (Required)
FSP was rounded, causing issues like inserting '2022-12-31 23:59:59.501011' into a DATETIME or TIMESTAMP column results in '2023-01-01 00:00:00'.
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: