pingcap / pingcap/tidb

Adds the MICROSECOND to the time is not compatible with Mysql

Open
#35,917 1 comment 0 reactions 0 assignees View on GitHub
severity/moderate sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```
use test;
drop table if exists PK_DATE2;
CREATE TABLE `PK_DATE2` (
`COL1` time NOT NULL,
`COL2` varchar(20) DEFAULT NULL,
`COL4` datetime DEFAULT NULL,
`COL3` bigint(20) DEFAULT NULL,
`COL5` float DEFAULT NULL,
PRIMARY KEY (`COL1`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into PK_DATE2(col1) values("-838:59:59");
SELECT timestampadd(MICROSECOND, 1, COL1) FROM PK_DATE2;
```
### 2. What did you expect to see? (Required)
mysql
```
MySQL [test]> SELECT timestampadd(MICROSECOND, 1, COL1) FROM PK_DATE2;
+------------------------------------+
| timestampadd(MICROSECOND, 1, COL1) |
+------------------------------------+
| -838:59:58.999999 |
+------------------------------------+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
```
MySQL [test]> SELECT timestampadd(MICROSECOND, 1, COL1) FROM PK_DATE2;
+------------------------------------+
| timestampadd(MICROSECOND, 1, COL1) |
+------------------------------------+
| 2022-05-30 01:00:01.000001 |
+------------------------------------+
1 row in set (0.00 sec)
```
### 4. What is your TiDB version? (Required)

```
MySQL [test]> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.2.0-alpha-262-g57ff144
Edition: Community
Git Commit Hash: 57ff1448ae630bc030b69adbad7e6495f603aa04
Git Branch: master
UTC Build Time: 2022-07-04 01:04:19
GoVersion: go1.18.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
Store: unistore |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.