-
-
Notifications
You must be signed in to change notification settings - Fork 270
Closed
Description
Expected behavior
Setting schema schould make effect on database connection:
databaseConfig.setDbSchema("test1");https://ebean.io/docs/database/postgres/#schema
Actual behavior
Setting databaseConfig.setDbSchema("test1") does nothing, schema is public.
Comment
I have checked source code and is seems, that Ebean is setting property schema but Postgresql uses currentSchema.
Setting ?currentSchema=test in URL solves this problem.
Source code from PostgreSQL JDBC driver ConnectionFactoryImpl.java:
private List<String[]> getParametersForStartup(String user, String database, Properties info) {
....
String currentSchema = PGProperty.CURRENT_SCHEMA.get(info);
if (currentSchema != null) {
paramList.add(new String[]{"search_path", currentSchema});
}
....
}And PGProperty.java:
CURRENT_SCHEMA(
"currentSchema",
null,
"Specify the schema (or several schema separated by commas) to be set in the search-path"),I think, that ConnectionPool.java should be changed from:
final String schema = params.getSchema();
if (schema != null) {
this.connectionProps.setProperty("schema", schema);
}to:
final String schema = params.getSchema();
if (schema != null) {
this.connectionProps.setProperty("currentSchema", schema);
}Metadata
Metadata
Assignees
Labels
No labels