Subject: [pgjdbc/pgjdbc] issue #3642: Calcutta/Kolkata time zone name mismatch prevents connection

From: "eirikbakke (@eirikbakke)" <[email-masked]>
Date: Wed, 28 May 2025 19:45:05 +0000

**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.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Wed, 28 May 2025 20:19:04 +0000

Yes, we have seen this before with some new TZ's where servers are not updated to the latest timezone database. In this case it seems it is the JDK <sigh>

---

From: "eirikbakke (@eirikbakke)" <[email-masked]>
Date: Wed, 28 May 2025 21:02:21 +0000

Yes, the incompatibility can probably happen in both directions. So for client apps that are supposed to be able to connect to any PostgreSQL version, it's not enough to merely upgrade the JDK version, as this would cause problems when connecting to older servers.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Sun, 01 Jun 2025 14:27:10 +0000

This issue duplicates https://github.com/pgjdbc/pgjdbc/issues/2311, so I'm closing this as duplicate.