pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: eirikbakke (@eirikbakke) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #2311: Why is client time zone not configurable?
Date: Thu, 05 Jun 2025 01:27:38 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

@vlsi That example makes sense; it makes it clear why TimeZone can't be set to GMT by default without breaking backwards compatibility.

Possible solutions (just brainstorming):
1) The already-suggested idea of letting the TimeZone parameter be set to an arbitrary value via a JDBC URL parameter or connection property.
2) Or, a simpler boolean JDBC URL property that _only_ exposes the option of setting TimeZone=GMT, rather than to an arbitrary time zone. But I could imagine cases where someone in Asia/Kolkata would want to connect with TimeZone=Asia/Calcutta to make some existing application "just work", without worrying about potential effects of switching to GMT. So maybe option (1) is better.
3) Or, keep the current behavior, but detect the 'invalid value for parameter "TimeZone"' error from the server and retry the connection automatically with an alternative time zone name for the known special cases (Kiev and Kyiv, Kolkata and Calcutta...).
4) Or, like (3), but connect always with TimeZone=GMT and use "SET SESSION TIME ZONE" to set the time zone instead, catching errors on the latter command. (Avoids re-authenticating etc., but means an extra network round trip in these time zones.)

In any case, it should probably be ensured that ResultSet.getTimestamp does not get affected by any change in the TimeZone parameter.

view thread (57+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #2311: Why is client time zone not configurable?
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox