the behavior of inserting time/duration to `varchar` through binary protocol is inconsistent with MySQL
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
Run the test `testUtilDateSetters` in `mysql-connector-j` on TiDB. The following line will fail:
```java
/* Into VARCHAR field */
String expDatetime2 = useSSPS
? zdt_20200101_120000_123456_on_wire.format(TimeUtil.DATETIME_FORMATTER_NO_FRACT_NO_OFFSET)
: expDatetime; // TODO milliseconds are ignored by server. Bug ?
String expDatetimeTS2 = useSSPS ? zdt_TS_on_wire.format(TimeUtil.DATETIME_FORMATTER_NO_FRACT_NO_OFFSET) : expDatetimeTS; // TODO milliseconds are ignored by server. Bug ?
String expTime2 = useSSPS ? expTimeNoMs : expTime; // TODO milliseconds are ignored by server. Bug ?
setObjectFromTz(props, tVarchar, utilDate, null, senderTz, expDatetimeTS2);
```
The TiDB's behavior is that the milliseconds are not ignored, but the behavior of MySQL is to ignore them. As shown in the comment, both I and the coders of `mysql-connector-j` are not sure whether it's a bug or not, so I just add this issue to record this difference and track the process of verifying it.
Contributor guide
Assessment
This issue has not been assessed yet.