Skip to content

Commit

Permalink
Escape schema name when setting search_path
Browse files Browse the repository at this point in the history
  • Loading branch information
sehrope committed Oct 14, 2014
1 parent 6be85f8 commit e708385
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion org/postgresql/jdbc2/AbstractJdbc2Connection.java
Expand Up @@ -1307,7 +1307,11 @@ public void setSchema(String schema) throws SQLException
{
if (schema != null)
{
stmt.executeUpdate("SET SESSION search_path TO '" + schema + "'");
StringBuffer sb = new StringBuffer();
sb.append("SET SESSION search_path TO '");
Utils.appendEscapedLiteral(sb, schema, protoConnection.getStandardConformingStrings());
sb.append("'");
stmt.executeUpdate(sb.toString());
}
else
{
Expand Down

0 comments on commit e708385

Please sign in to comment.