pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: eirikbakke (@eirikbakke) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3642: Calcutta/Kolkata time zone name mismatch prevents connection
Date: Wed, 28 May 2025 19:45:05 +0000
Message-ID: <[email protected]> (raw)
**Describe the issue**
If a user with a Java client version that runs with the time zone "Asia/Calcutta" connects to a PostgreSQL server that uses the newer equivalent name "Asia/Kolkata" for the same time zone, the following exception is seen:
```
org.postgresql.util.PSQLException: FATAL: invalid value for parameter "TimeZone": "Asia/Calcutta"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725)
at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2837)
at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:175)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:317)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:273)
at org.postgresql.Driver.makeConnection(Driver.java:446)
at org.postgresql.Driver.connect(Driver.java:298)
```
I suspect the same can happen with mismatches between "Europe/Kiev" and "Europe/Kyiv" as well (another recent name change I have seen in time zone databases).
The relevant JDBC driver code is in `org.postgresql.core.v3.ConnectionFactoryImpl.createPostgresTimeZone()`. For the time zones "Asia/Calcutta", "Asia/Kolkata", "Europe/Kiev", and "Europe/Kyiv", it would probably be better to generate an offset-based time zone name that works regardless of server version and distribution. Or if it's not possible to pass offset-based time zone names for the TimeZone connection parameter, perhaps pass "GMT" instead and automatically call "SET SESSION TIME ZONE INTERVAL" to set the offset instead.
**Driver Version?**
42.7.3
**Java Version?**
21.0.4
**OS Version?**
Windows
**PostgreSQL Version?**
Unknown (bug was reported by a user of my database UI product, [Ultorg](https://www.ultorg.com/)).
**To Reproduce**
Use a PostgreSQL server that uses the newer "Asia/Kolkata" time zone name. For the client, use OpenJDK 21.0.4 for Windows which uses the older "Asia/Calcutta". Then set the machine time zone to India time and attempt to connect.
**Expected behaviour**
The connection should succeed, but does not.
**Logs**
See the earlier-pasted stack trace.
view thread (4+ 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 #3642: Calcutta/Kolkata time zone name mismatch prevents connection
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