Skip to content

Stabilize DST-sensitive timestamptz assertions in PostgreSQLSqlDialectIT #92

Description

@kaklakariada

Problem

src/test/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialectIT.java contains hard-coded expectations for PostgreSQL TIME WITH TIME ZONE and TIMESTAMP WITH TIME ZONE values even though the test setup does not pin the JVM or Exasol session timezone.

The fixture inserts:

  • myTimeWithTimeZone: 11:11:11 +01:00
  • myTimestampWithTimeZone: 2010-01-01 11:11:11 +01:00

The current test expectation for myTimestampwithtimezone has already needed to move from 2010-01-01 11:11:11 to 2010-01-01 12:11:11, which indicates that the observed value depends on the runtime timezone offset.

Why this is DST-sensitive

The inserted timestamptz value represents a fixed instant: 2010-01-01T10:11:11Z. The test, however, compares it to a local TIMESTAMP without fixing the session timezone. When the environment or session is effectively on UTC+1, the observed local value is 11:11:11; when it is on UTC+2 during daylight saving time, it becomes 12:11:11.

The same risk exists for testDatatypeTimeWithTimezone().

Suggested fix

Make the test deterministic by doing one of the following:

  • Pin the timezone used by the test setup before asserting values.
  • Set the Exasol session timezone explicitly for the integration test.
  • Compute the expected local timestamp dynamically from the effective session timezone instead of hard-coding 11:11:11 or 12:11:11.

Acceptance criteria

  • PostgreSQLSqlDialectIT passes unchanged in both standard-time and DST periods.
  • Expectations for myTimeWithTimeZone and myTimestampwithtimezone no longer depend on the machine or session timezone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnwanted / harmful behavior

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions