Scalingo App TZ Variable and Managed PostgreSQL Session Timezone Interoperability
0 reputation · 22 Nov 2024, 13:51 UTC
Applications running on Scalingo can define a TZ environment variable that is injected into the container and influences the runtime clock used by language‑specific APIs. Managed PostgreSQL addons on the platform, however, default to UTC for session time zone unless the application explicitly issues a SET TIME ZONE command after connecting. This creates a potential mismatch between timestamps generated by the application code and those stored or returned by the database, especially when the app relies on the injected TZ for civil‑time calculations. The goal is to determine whether the platform automatically propagates the app‑level TZ variable to the PostgreSQL session, or whether developers must handle the conversion themselves to achieve consistent timestamp handling across the app‑database boundary.
Does Scalingo automatically set the PostgreSQL session time zone to the value of the app‑level TZ environment variable for new connections?
If not, what is the recommended approach for the application to synchronize its civil‑time logic with the database without introducing drift?
How does the Scheduler’s default UTC execution affect jobs that depend on the same TZ‑aware timestamps?