Message-ID: From: "eirikbakke (@eirikbakke)" To: "pgjdbc/pgjdbc" Date: Thu, 05 Jun 2025 17:35:50 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #2311: Why is client time zone not configurable? In-Reply-To: References: List-Id: X-GitHub-Author-Login: eirikbakke X-GitHub-Comment-Id: 2945415495 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 2311 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/2311#issuecomment-2945415495 Content-Type: text/plain; charset=utf-8 > How would we know the correct TZ ? For that option, the JDBC driver would have to hard-code time zones with known name changes, and try one after the other. (Yes, quite ugly.) > Well changing the TZ will change the result of getTimestamp. The server changes the time based on the session TZ. It does not store TZ in the data. The java.sql.Timestamp instance is created by the JDBC driver, no? So if the JDBC driver connects to the server with connection parameter TimeZone=GMT, I'd imagine the JDBC driver would receive the timestamp at GMT/UTC, but then convert it to the local JDK time zone for the purposes of creating the java.sql.Timestamp object (when working with `timestamptz` values). That way, the change to TimeZone=GMT can be regarded as a JDBC driver implementation detail that does not change the semantics of getTimestamp(). (But as @vlsi pointed out it would still change the string representation of `timestamptz` when casted to `text`.)