Add support for PostgreSQL schemas in DSN (#6150)

If schema is set in the dsn, set search_path to the schema value.

Example:

$config['db_dsnw'] = 'pgsql://user:pass@localhost/dbname?schema=exampleschema';
This commit is contained in:
laodc
2018-01-30 13:51:54 +07:00
committed by Aleksander Machniak
parent 59a63c95a4
commit edeb5d7ab4

View File

@@ -56,6 +56,11 @@ class rcube_db_pgsql extends rcube_db
{
$dbh->query("SET NAMES 'utf8'");
$dbh->query("SET DATESTYLE TO ISO");
// if ?schema= is set in dsn, set the search_path
if ($dsn['schema']) {
$dbh->query("SET search_path TO " . $this->quote($dsn['schema']));
}
}
/**