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
stop rounding times #1172
stop rounding times #1172
Conversation
https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html MySQL supports only milliseconds. Do we need to send nanoseconds? |
You mean microseconds? At least, we need to send 100 nanoseconds (7 digits) precision. Some examples:
As you say, currently MySQL only supports up to microseconds. |
I think you are right, but still feel it is a bit too much. #1121 is really a bug. Round off 1.4449995 to 1.45 doesn't make sense at all. Let's check another connectors behavior. |
It seems Connector/J just nano/1000 when store it in binary protocol. https://github.com/mysql/mysql-connector-j/blob/d64b664fa93e81296a377de031b8123a67e6def2/src/main/core-impl/java/com/mysql/cj/ServerPreparedQueryBindValue.java#L325 But they round or truncate nanoseconds based on TIME_TRUNCATE_FRACTIONAL sql_mode. |
I think this pull request is good for v1.6. @shogo82148 would you merge master branch to run CI? |
@methane I did! |
Is it safe to trim trailing 0s? |
Maybe, it is. |
It looks that starting MySQL server fails on macOS. it is not due to my pull request. https://github.com/go-sql-driver/mysql/pull/1172/checks?check_run_id=1806566232
|
Thank you for your review! |
* master: (93 commits) return unsigned in database type name when necessary (go-sql-driver#1238) add an invalid DSN test case (go-sql-driver#1235) refactoring (*textRows).readRow in a more clear way (go-sql-driver#1230) use utf8mb4 instead of utf8 in TestCharset (go-sql-driver#1228) improve readability follows go-staticcheck (go-sql-driver#1227) support Is comparison on MySQLError (go-sql-driver#1210) Wording correction in README (go-sql-driver#1218) noCopy implements sync.Locker (go-sql-driver#1216) Fix readme: MaxIdle is same or less than MaxOpen (go-sql-driver#1215) Drop support of Go 1.12 (go-sql-driver#1211) Release v1.6.0 (go-sql-driver#1197) add Go 1.16 to the build matrix (go-sql-driver#1198) Implement driver.Validator interface (go-sql-driver#1174) handling decoding pem error (go-sql-driver#1192) stop rounding times (go-sql-driver#1172) improve GitHub Actions workflows (go-sql-driver#1190) Move tests from Travis to Actions (go-sql-driver#1183) Fix go vet error (go-sql-driver#1173) README: Make usage code more friendly (go-sql-driver#1170) Fix a broken link to cleartext client side plugin (go-sql-driver#1165) ...
Description
fixes #1121
Checklist