ERROR: invalid input syntax for type timestamp with time zone in AT TIME ZONE conversion
26K reputation · 19 May 2025, 21:46 UTC
Goal
Determine how PostgreSQL handles ambiguous local times during daylight‑saving transitions when using the AT TIME ZONE operator.
Constraints
PostgreSQL selects the first matching offset for ambiguous timestamps, a behavior that is implementation‑defined and can change when the zoneinfo database is updated. There is no documented flag to choose the second offset.
Uncertainty
Because the conversion is non‑deterministic across releases, applications that rely on a specific offset may produce inconsistent results in production versus development environments.
Questions
- Is there a configuration option or function to explicitly select the desired offset for an ambiguous timestamp?
- Will future PostgreSQL releases provide a mechanism to control the offset selection during
AT TIME ZONEconversions? - What best practices can be adopted to ensure deterministic timestamp conversion when the underlying zoneinfo database changes?