pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feed[pgjdbc/pgjdbc] issue #3605: PgConnection.setSchema() does not support multiple schemas
3+ messages / 2 participants
[nested] [flat]
* [pgjdbc/pgjdbc] issue #3605: PgConnection.setSchema() does not support multiple schemas
@ 2025-04-15 07:36 "cgm-aw (@cgm-aw)" <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: cgm-aw (@cgm-aw) @ 2025-04-15 07:36 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
**Describe the issue**
According to the [documentation](https://jdbc.postgresql.org/documentation/use/#connection-parameters), `currentSchema` can be a comma-separated list of schemas. While this works for the connection string, it does not work for `PgConnection.setSchema()`.
**Driver Version?**
Latest
**Java Version?**
Any
**OS Version?**
Any
**PostgreSQL Version?**
Any
**To Reproduce**
Call `PgConnection.setSchema("a, b")` - the search path will be set to the string "a, b" instead to the schemas "a" and "b".
**Expected behaviour**
The search path should be set to a list of schemas if a comma-separated list is provided.
**Comments**
This is because `PgConnection.setSchema()` puts single quotes around the passed schema:
```
StringBuilder sb = new StringBuilder();
sb.append("SET SESSION search_path TO '"); // See here
Utils.escapeLiteral(sb, schema, getStandardConformingStrings());
sb.append("'"); // and here
```
I'm happy to provide a reproducer if you need one, but I think the issue is pretty clear.
There is some escaping going on, a comma-separated list passed a a string ("a, b") should of course be escaped to: 'a', 'b'
I don't know if you have helpful utils to do this, so I didn't create a pull request. If you like, I can try :)
Best regards
Andreas
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3605: PgConnection.setSchema() does not support multiple schemas
@ 2025-04-15 12:31 "davecramer (@davecramer)" <[email protected]>
1 sibling, 0 replies; 3+ messages in thread
From: davecramer (@davecramer) @ 2025-04-15 12:31 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
Great find, thanks, and yes a PR would be welcome
Dave
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3605: PgConnection.setSchema() does not support multiple schemas
@ 2025-04-15 14:31 "cgm-aw (@cgm-aw)" <[email protected]>
1 sibling, 0 replies; 3+ messages in thread
From: cgm-aw (@cgm-aw) @ 2025-04-15 14:31 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
Please check my PR: https://github.com/pgjdbc/pgjdbc/pull/3606
I could not get all tests running, but I'm pretty sure that is not due to my change. I would be glad if a maintainer could run all tests to make sure.
Also please make sure this looks downwards-compatible to you, I tried my best to do so.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-04-15 14:31 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-04-15 07:36 [pgjdbc/pgjdbc] issue #3605: PgConnection.setSchema() does not support multiple schemas "cgm-aw (@cgm-aw)" <[email protected]>
2025-04-15 12:31 ` "davecramer (@davecramer)" <[email protected]>
2025-04-15 14:31 ` "cgm-aw (@cgm-aw)" <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox