Subject: [pgjdbc/pgjdbc] issue #3723: `connection.setSchema("invalid_schema")` should throws IllegalArgumentException

From: "quaff (@quaff)" <[email-masked]>
Date: Wed, 09 Jul 2025 02:12:15 +0000

Currently, `connection.setSchema("invalid_schema")` is silently ignored, later `connection.getSchema()` returns `null`, I think it's inconsistent here.

See https://github.com/brettwooldridge/HikariCP/issues/2323 for more background.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Wed, 09 Jul 2025 11:48:54 +0000

Well, postgres does not throw an error if you execute set `search_path='invalid_schema'` and subsequent calls to `current_schema()` return null as per current_schema () → name

Returns the name of the schema that is first in the search path (or a null value if the search path is empty). This is the schema that will be used for any tables or other named objects that are created without specifying a target schema. 

See https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-SESSION