Message-ID: From: "davecramer (@davecramer)" To: "pgjdbc/pgjdbc" Date: Thu, 17 Apr 2025 13:26:15 +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: davecramer X-GitHub-Comment-Id: 2812909668 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-2812909668 Content-Type: text/plain; charset=utf-8 > I'm happy to change it, but this would alter the behavior of the method and might break existing code. Maybe rather update the documentation, that `getSchema()` returns the results of `current_schema()`, which shows the first element on the search_path? I guess this is up to you to decide; personally, I would not change `getSchema()`. Obviously setting a list of schemas is an edge case, since I'm the first to report it. If I connect with psql and just run `show search_path` I get this: > > ``` > postgres=# show search_path; > search_path > ----------------- > "$user", public > (1 row) > > postgres=# select current_schema(); > current_schema > ---------------- > public > (1 row) > ``` > > I'm out of my depth here, but it seems like the schema `"$user"` is hidden from `current_schema()`. I never heard of this $user schema, so I cannot really explain what is going on. FYI `If one of the list items is the special name $user, then the schema having the name returned by CURRENT_USER is substituted, if there is such a schema and the user has USAGE permission for it. (If not, $user is ignored.)` but in regards to getSchema, currently `getSchema()` returns whatever schema was set in `setSchema()` In a way this patch breaks that