Repository navigation
fix: Preserve TIMESTAMP_LTZ instants in jdbc-sqrl regardless of JVM time zone - #424
Merged
Merged
Conversation
…ime zone Signed-off-by: Ferenc Csaky <ferenc@datasqrl.com>
mateczagany
approved these changes
Oct 21, 2026
ferenc-csaky
added a commit
that referenced
this pull request
Oct 21, 2026
…ime zone (#424) Signed-off-by: Ferenc Csaky <ferenc@datasqrl.com>
This was referenced Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
jdbc-sqrlconvertedTIMESTAMP_LTZvalues through the wall-clock methods ofjava.sql.Timestamp(TimestampData#toTimestampon write,TimestampData.fromTimestampon read), which interpret the value in the JVM default time zone. On a JVM that does not run in UTC, everyTIMESTAMP_LTZwritten to a Postgrestimestamptzcolumn was shifted by that zone's offset (e.g. +8h in winter and +7h in summer forAmerica/Los_Angeles), and values read back were shifted in the opposite direction.Both converters now go through
Instant, so the stored and read instant is the same regardless of the JVM time zone. On a JVM that runs in UTC, the behavior is unchanged.Area
flink-sql-runner)connectors)formats)stdlib)env-utils)testing)README.md,stdlib-docs)How did you test it?
SqrlJdbcTimestampLtzTest, which writes aTIMESTAMP_LTZto Postgres throughjdbc-sqrl(Testcontainers) and converts a JDBCTimestampback, with the JVM time zone set toUTC,America/Los_AngelesandAsia/Kolkata.postgresql-connectortests (20, including the 6 new cases) andspotless:checkpass.FullUseCaseITsuite of DataSQRLmain(48 use cases) against this change. That suite runs withTZ=America/Los_Angeles, and 7 snapshots in 5 use cases (avro-schema,filtered-distinct,function-translation/flink,sensors-teaser,simple-with-bigint-support) currently contain the shifted values. With this change, they contain the instants of the source data instead, e.g.2023-01-02T22:24:00Zinstead of2023-01-03T06:24:00Z. No other snapshot changes. Without this change, all 48 use cases pass.DataSQRL
mainconsumes1.0-SNAPSHOT, so those snapshots need to be updated in DataSQRL together with this change.Checklist
feat:,fix:ordocs:, optionally with a scope (e.g.fix(flexible-json):)mvn clean installpasses locally and the code is formatted withmvn spotless:apply(formatted; only thepostgresql-connectorbuild and tests were run locally)given_when_thennaming, AssertJ assertions)pom.xml(no new dependencies)git commit -s -S)README.mdandstdlib-docsare updated if user-facing behavior or functions changed (no docs change needed)🤖 Generated with Claude Code