Message-ID: From: "eirikbakke (@eirikbakke)" To: "pgjdbc/pgjdbc" Date: Wed, 28 May 2025 19:45:05 +0000 Subject: [pgjdbc/pgjdbc] issue #3642: Calcutta/Kolkata time zone name mismatch prevents connection List-Id: X-GitHub-Author-Id: 886243 X-GitHub-Author-Login: eirikbakke X-GitHub-Issue: 3642 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: closed X-GitHub-Type: issue X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3642 Content-Type: text/plain; charset=utf-8 **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.(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.(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.