Subject: [pgjdbc/pgjdbc] PR #3655: fix: ensure Connection.isValid() returns true even if prepared statements deallocate

From: "vlsi (@vlsi)" <[email-masked]>
Date: Fri, 06 Jun 2025 11:28:29 +0000

Previously, the code for `.isValid()` was using `executeWithFlags("", QueryExecutor.QUERY_EXECUTE_AS_SIMPLE)`

However, the execution still went with extended query protocol since `QueryExecutorImpl#updateQueryMode` trimmed the flag in `preferQueryMode=extended` (default) mode.

It does not feel right to trim the flag there since the intention of the option was to "prefer" query mode unless specified explicitly.

The case is identified and tested in `AutoRollbackTest`: isValid should return true after statements like DEALLOCATE, `DISCARD`, and so on.

See https://github.com/pgjdbc/pgjdbc/pull/3631
Fixes https://github.com/pgjdbc/pgjdbc/issues/3630

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Fri, 06 Jun 2025 11:51:36 +0000

(on pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java:321)

hmmm, how long has that been there ?

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Fri, 06 Jun 2025 12:00:33 +0000

It has been sitting there for almost 9 years since 232569c6bd9eb625fc70ebe642d35c8256726a16