Skip to content

Commit

Permalink
Setting the search_path from currentSchema property is done in startu…
Browse files Browse the repository at this point in the history
…p packet (v3 protocol only)
  • Loading branch information
alexismeneses committed Nov 20, 2014
1 parent 8d11432 commit 3c676cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 9 additions & 0 deletions org/postgresql/core/v2/ConnectionFactoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -490,5 +490,14 @@ else if (dbEncoding != null)
sb.append("'");
SetupQueryRunner.run(protoConnection, sb.toString(), false);
}

String currentSchema = info.getProperty("currentSchema");
if (currentSchema != null)
{
StringBuffer sb = new StringBuffer("SET search_path = '");
Utils.appendEscapedLiteral(sb, appName, protoConnection.getStandardConformingStrings());
sb.append("'");
SetupQueryRunner.run(protoConnection, sb.toString(), false);
}
}
}
7 changes: 7 additions & 0 deletions org/postgresql/core/v3/ConnectionFactoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ else if ("require".equals(sslmode) || "verify-ca".equals(sslmode) || "verify-ful
// User has not explicitly told us that this is a 9.0+ server so stick to old default:
paramList.add(new String[] {"extra_float_digits", "2"});
}

String currentSchema = info.getProperty("currentSchema");
if (currentSchema != null)
{
paramList.add(new String[] {"search_path", currentSchema});
}

String[][] params = paramList.toArray(new String[][]{});

sendStartupPacket(newStream, params, logger);
Expand Down
6 changes: 0 additions & 6 deletions org/postgresql/jdbc2/AbstractJdbc2Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,6 @@ else if (stringType.equalsIgnoreCase("varchar"))
}
this.disableColumnSanitiser = Boolean.valueOf(info.getProperty(""
+ "disableColumnSanitiser", Boolean.FALSE.toString()));

String currentSchema = info.getProperty("currentSchema");
if (currentSchema != null)
{
setSchema(currentSchema);
}
}

private Set<Integer> getOidSet(String oidList) throws PSQLException {
Expand Down

0 comments on commit 3c676cd

Please sign in to comment.