-
Notifications
You must be signed in to change notification settings - Fork 184
Decoding java.time.Instant
is not correct when temporal is LocalDateTime
#517
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
Comments
Thanks for the report. We tried to align with the JDBC driver, need to check what's going on. |
Have I mentioned how much I dislike timezones ? |
When you find out, let me know :) |
Here's the result of my analysis based on the
The In contrast, the JDBC driver works as follows:
Coming back to the initial report, a zoned temporal value requires local zone information for conversion into a See https://gist.github.com/mp911de/301bcdb05ca16b6f9d8eda51f76653bb for a reproducer. |
At which timezone ? Since the database does not store timezone information. What it does is use the session timezone. Do we have a way to specify the session timezone ? |
The Postgres response string was So going forward, the |
What the JDBC driver does is set the PostgreSQL session timezone to the clients timezone. So regardless of the servers timezone the client sees the date in their timezone. Further it's my understanding that if you don't set the session timezone you will get the timezone that is set in the server. Imagine querying data which is spread across multiple timezones. Unless the server timezone is set to UTC, you would get a different answer from each timezone. Further if somehow the timezone of the server were to be changed the times would also change. (BTW, did I mention I dislike timezones ) |
done. |
r2dbc-postgresql/src/main/java/io/r2dbc/postgresql/codec/InstantCodec.java
Lines 44 to 54 in 9c773c8
I'm not a Java time expert but I think the correct way to convert
LocalDateTime
toInstant
is to do this:In my test case binding and reading an instant produces different values shifted by my local timezone.
The text was updated successfully, but these errors were encountered: