Join GitHub today
Escape search_path in Connection.setSchema(...) #207
This works fine to handle whitespace in a schema name (ex: "
This patch replaces the single quoted schema name in the query string with an escaped identifier. I've also added a couple tests with funky schema names.
While testing this patch out, I noticed that
This means that the following would not work:
You can see this first hand in the additional schema tests I added. The
I don't think that's correct.
PS: For the sake of discussion, let's put aside how silly it would be to have schemas with spaces or single quotes...
Does it deal with UPPER case schema names ?
On 14 October 2014 13:11, Sehrope Sarkuni firstname.lastname@example.org wrote:
No it didn't deal with it properly as they weren't escaped properly when treated as identifiers.
I've updated the patch to go back to passing the schema name as a literal escaped via
I also added a test with a mixed-case schema name that now passes.
Somewhat related, looking at the Travis CI output (https://travis-ci.org/pgjdbc/pgjdbc/jobs/37962958) I don't think the JDBC 4 tests are running. They run successfully on my local machine but I think something is misconfigured in either the Travis config file or whatever build properties it's using to determine the tests to run.
To put my 2 cents in concerning
I do not feel there's a real compatibility break here as
The consistent behavior between both methods seems more important to me
added a commit
this pull request
Dec 1, 2014
referenced this pull request
Dec 4, 2014
This patch breaks search_path entries which lists multiple schemas in a search order as it single-quotes the entire entry - e.g. #setSchema("myschema, public") gets interpreted as SET SESSION search_path TO 'myschema, public'; instead of SET SESSION search_path TO myschema, public;
This behavior is intended as the JDBC 4.1 specification expect the string argument of
You need to send the SQL directly if you want to handle multiple schema names in the search_path.
Actually, it is probably too late to talk about this, but does the current
-- Valentine Gogichashvili
On Tue, Feb 17, 2015 at 11:00 AM, Frode Carlsen email@example.com