pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: cgm-aw (@cgm-aw) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] PR #3606: fix: add support for multiple schemas via PgConnection.setSchema
Date: Wed, 23 Apr 2025 12:15:13 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Ok, I changed `getSchema` to call `SHOW search_path`.
I noticed this in a test case:
Before (current_schema()):
```
execute("SET search_path TO \"$user\",public,schema2");
assertEquals(TestUtil.getUser(), conn.getSchema()); // Now fails
```

After (show search_path):
```
execute("SET search_path TO \"$user\",public,schema2");
assertEquals("\"$user\", public, schema2", conn.getSchema()); // OK
```

So this means that `current_schema()` resolves the schema `$user` to the respective user name, while `SHOW search_path` keeps the variable in its output. Since you would use the variable in the SET command, I guess this is fine.

Let me know if the PR is ok now, then I will look forward to the release 😃 

view thread (19+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] PR #3606: fix: add support for multiple schemas via PgConnection.setSchema
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox