Skip to content

Conversation

@kasemir
Copy link
Collaborator

@kasemir kasemir commented Dec 12, 2025

The sample.smpl_time is handled differently for MySQL, Postgres, Oracle.

In MySQL, it's stored as UTC. The Timestamp passed to PreparedStatement.setTimestamp(Timestamp) is converted to UTC and stored as UTC. On retrieval, ResultSet.getTimestamp converts back to the local time zone with appropriate GMT offset.

In Postgres, we need to use a TIMESTAMPTZ datatype that stores the stamp with timezone info.

Both MySQL and Postgres handle the fall transition from daylight savings time back to standard time just fine.

In Oracle, even if we use TIMESTAMP WITH TIMEZONE for smpl_time, Oracle JDBC will second-guess the Timestamp passed to setTimestamp(Timestamp) and change the time offset. During the DST change in the fall, time stamps will be written with the wrong GMT offset.
The workaround is to use setObject(OffsetDateTime) because OffsetDateTime is passed through and written as received.

Checklist

  • Testing: Manual with test database setup. Ultimate test will happen in November 2026.

Data during the last EDT to EST change might look like this:

2025-11-02T00:30-04:00
2025-11-02T01:30-04:00
2025-11-02T01:30-05:00
2025-11-02T02:30-05:00

Note that the local time 01:30 is logged with the correct time zone info during the transition.

Before this change, with Oracle you would get

2025-11-02T00:30-04:00
2025-11-02T01:30-04:00
2025-11-02T01:30-04:00
2025-11-02T02:30-05:00

or

2025-11-02T00:30-04:00
2025-11-02T01:30-05:00
2025-11-02T01:30-05:00
2025-11-02T02:30-05:00

where both instances of 01:30 are erroneously in the same zone offset.

  • Documentation:
    • The feature is documented
    • The documentation is up to date
    • Release notes:
      • Added an entry if the change is breaking or significant
      • Added an entry when adding a new feature

The sample.smpl_time is handled differently for MySQL, Postgres, Oracle.

In MySQL, it's stored as UTC. The `Timestamp` passed to
`PreparedStatement.setTimestamp(Timestamp)` is converted to UTC and
stored as UTC. On retrieval, `ResultSet.getTimestamp` converts back to
the local time zone with appropriate GMT offset.

In Postgres, we need to use a `TIMESTAMPTZ` datatype that stores the
stamp with timezone info.

Both MySQL and Postgres handle the fall transition from daylight savings
time back to standard time just fine.

In Oracle, even if we use `TIMESTAMP WITH TIMEZONE` for smpl_time,
Oracle JDBC will second-guess the Timestamp passed to
`setTimestamp(Timestamp)` and change the time offset. During the DST
change in the fall, time stamps will be written with the wrong GMT
offset.
The workaround is to use `setObject(OffsetDateTime)` because
OffsetDateTime is passed through and written as received.
@kasemir kasemir merged commit 27499f5 into master Dec 15, 2025
3 checks passed
@kasemir kasemir deleted the arch_rdb_oracle_timezone branch December 15, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants