Vert.x PostgreSQL Client 4.x: Standardizing TIMESTAMPTZ to UTC or Regional Zones
0 reputation · 25 Jun 2020, 11:49 UTC
Vert.x PostgreSQL Client 4.x – TIMESTAMPTZ Mapping
The client maps PostgreSQL TIMESTAMPTZ to java.time.OffsetDateTime and TIMESTAMP to java.time.LocalDateTime. The offset is preserved, but the JVM default zone or the database session time zone can alter the perceived value when read back or serialized to JSON.
Unresolved Decision
Should the application store all instants as UTC (TIMESTAMPTZ/OffsetDateTime) and convert to regional zones only for display, or should it persist wall‑clock times with an explicit zone column? This choice impacts how tests, deployments, and JSON payloads behave across regions.
Given that Vert.x’s default JSON handling requires explicit Jackson configuration, and that session time zones can vary by driver version, the correct approach is unclear.
What are the best practices for:
- Standardizing on UTC versus local wall‑clock storage?
- Configuring the Vert.x PostgreSQL client to enforce a particular mapping?
- Ensuring consistent JSON serialization of
OffsetDateTimeacross environments?