Message-ID: From: "cgm-aw (@cgm-aw)" To: "pgjdbc/pgjdbc" Date: Thu, 17 Apr 2025 12:53:05 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #3606: fix: add support for multiple schemas via PgConnection.setSchema In-Reply-To: References: List-Id: X-GitHub-Author-Login: cgm-aw X-GitHub-Comment-Id: 2812770698 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3606 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3606#issuecomment-2812770698 Content-Type: text/plain; charset=utf-8 Yes `current_schema()` is a bit misleading, although the documentation states it correctly: "Returns the name of the schema that is **first** in the search path" - it does not say that it shows **all** schemas on the search_path. To view all schemas on the path, you have to call `show search_path`. Check this output: ``` postgres=# set session search_path to 'postgres','public'; SET postgres=# select current_schema(); current_schema ---------------- public (1 row) postgres=# show search_path; search_path ------------------ postgres, public (1 row) ``` So Postgres does indeed support multiple schemas on the search path, which is why the JDBC driver allows setting multiple schemas in the connection string. I need this feature because in our enterprise setting, I cannot edit the JDBC connection string and I have multiple database functions which call other functions without the schema in their prefix, which I also cannot edit. So to make my setup work, I have to be able to programmatically add multiple schemas to my search_path. Of course I could call `set session search_path to...` in my application, but I think support in the driver would be nice 😃