Support timestamp with timezone/offset #4201
Replies: 6 comments 8 replies
-
So I think there's essentially no problem here. Let me describe the current state of the H6 branch:
It's been suggested that the current behavior in H5 is perfectly fine, but just I don't think that's right:
Note that none of the above discussion applies to (Caveat: it's possible I have some of the above details slightly wrong because it's a long time since I worked on this stuff.) |
Beta Was this translation helpful? Give feedback.
-
I spoke with @beikov about this a bit this morning. He suggested adding a I can see that we may all disagree about the interpretation of AUTO, but hopefully we can all agree on the approach. We could also even introduce a setting to control the interpretation of AUTO (i.e. We came up with the set of strategies as:
Not tied to the name PICK, just all I can think of atm |
Beta Was this translation helpful? Give feedback.
-
I think the |
Beta Was this translation helpful? Give feedback.
-
SQL Server JDBC drivers support TIMESTAMP_WITH_TIMEZONE:
https://stackoverflow.com/questions/51273979/localdatetime-and-sql-server-jdbc-4-2-driver mentions v7.1.1 as "fixing" version. Current is 9.4.1. I can set parameter:
but when I retrieve parameter of SQL type
it is of type |
Beta Was this translation helpful? Give feedback.
-
So, we're having to revisit this unfortunately. What has occurred to me today is to think of what are the possible strategies if I want really portable, consistent behavior across databases. And I think there are just
Options 2 and 4 always preserve the time zone info. Options 1 and 3 always normalize to UTC and throw away the timezone. Option 5 may or may not preserve the time zone info, but it at least conserves the "instant" part of the datetime. I don't think we should use a separate column unless the user explicitly requests it. It's just a "weird" thing to do. Rules out 2 + 4. Also, I don't think that if the user has explicitly used an That leaves 5 as a reasonably default behavior. (Under the assumption of "portable semantics".) |
Beta Was this translation helpful? Give feedback.
-
See my summary of this matter here: https://hibernate.atlassian.net/browse/HHH-15820?focusedCommentId=110421 |
Beta Was this translation helpful? Give feedback.
-
We figured out that most databases do not support what JDBC and the SQL standard had in mind for TIMESTAMP_WITH_TIMEZONE which is, that the timezone/offset is stored. Only the following databases implement this, AFAIK:
This means that for every other database, we would need to have a dedicated column to store the timezone/offset, which requires a composite user type.
Beta Was this translation helpful? Give feedback.
All reactions