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

Support TIMESTAMPS with precisions higher than 3 in MySQL #6910

Closed
hashhar opened this issue Feb 16, 2021 · 2 comments
Closed

Support TIMESTAMPS with precisions higher than 3 in MySQL #6910

hashhar opened this issue Feb 16, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@hashhar
Copy link
Member

hashhar commented Feb 16, 2021

  • Currently the MySQL connector reads timestamp/datetime values as TIMESTAMP(3) and only supports writing TIMESTAMP(3) even though MySQL supports values upto precision 6.
  • Due to MySQL using the legacy default type-mappings we cannot round-trip timestamps which lie within a "gap" in some timezone.

While making this change, proper tests should be added to assert both datetime and timestamp values round-trip properly (where possible).

rel #5449

@hashhar
Copy link
Member Author

hashhar commented Mar 7, 2021

For properly supporting reading timestamp(p) where p matches the precision as defined in MySQL we need to upgrade the JDBC driver to include mysql/mysql-connector-j@696c6c4 (first available in 8.0.16).

Any driver older than that doesn't return the precision for temporal data tyes. And any server version older than 5.6.4 doesn't support fractional seconds in any timestamp type at all (everything is limited to seconds precision).

To finish this work I'm working on upgrading the JDBC driver first.

NOTE: Trying to read as a String using getObject also doesn't help because MySQL doesn't return fixed width strings depending on precision of column. i.e. a value with fractional seconds as 123000 in a datetime(6) column is returned as a string ending in .123 instead of .123000. So we can't use this to infer the precision of the column when reading the values.

@hashhar
Copy link
Member Author

hashhar commented Jun 28, 2021

Fixed by merging #8060.

@hashhar hashhar closed this as completed Jun 28, 2021
@hashhar hashhar mentioned this issue Jun 28, 2021
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant