PostgreSQL Timestamp Shifted by Hours (`timestamp` vs `timestamptz`)

Storing UTC in `timestamp without time zone` caused session timezone misinterpretation.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: PostgreSQL Timestamp Shifted by Hours (`timestamp` vs `timestamptz`) Platform: PostgreSQL
Common Root Causes:
  • Storing UTC in `timestamp without time zone` caused session timezone misinterpretation.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Always store instants as `TIMESTAMPTZ` (timestamp with time zone) and standardize UTC.
Safe Diagnostic Command:
SHOW TimeZone;
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

Storing UTC in `timestamp without time zone` caused session timezone misinterpretation. Recommended diagnostic: `SHOW TimeZone;`. Remediation: Always store instants as `TIMESTAMPTZ` (timestamp with time zone) and standardize UTC.

Worked Examples

  • Run `SHOW TimeZone;` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-pg-timezone-timestamptz-shift · Independently verified: 2026-11-25

Related Resources