From: | Sri Keerthi <ksri7840(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Allowing user-specified timezone in pg_regress sessions |
Date: | 2025-08-28 10:56:46 |
Message-ID: | CAGGQ0Y1wfdFaUYYnDv8quSTNvmUNZgtLKw5h8rn8Q0hZT37g4A@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Team,
I have tried writing regression tests for a PostgreSQL extension and
encountered a limitation with pg_regress regarding session timezones.
The issue is as follows:
pg_regress internally calls putenv("PGTZ=PST8PDT") and
putenv("PGDATESTYLE=Postgres,
MDY") for each test session. This ensures that the core PostgreSQL
regression tests are deterministic. However, it also *overrides any
timezone or datestyle settings, including those configured via ALTER SYSTEM
or exported environment variables* set before running make installcheck.
As a result, even if I export a different timezone (e.g., Asia/Kolkata) in
my shell or set it globally via ALTER SYSTEM, the regression sessions still
use PST8PDT.
Currently, the only reliable way I have found to run tests in a specific
timezone is to add SET timezone = '...' at the top of each SQL test file.
While this works, it is tedious and not ideal, especially when working with
many test files or when the extension’s behavior needs to be validated
across different time zones.
I am reaching out to the community to ask:
Is there any recommended approach to run regression tests in a
user-specified timezone *without modifying each SQL test file*?
Any guidance, best practices, or alternative approaches would be greatly
appreciated.
Thank you for your time and suggestions.
Best regards,
Sri Keerthi R.
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2025-08-28 11:09:04 | Re: Conflict detection for update_deleted in logical replication |
Previous Message | shveta malik | 2025-08-28 10:07:00 | Re: Conflict detection for update_deleted in logical replication |