Index: database.pgsql.inc =================================================================== --- database.pgsql.inc (révision 599) +++ database.pgsql.inc (copie de travail) @@ -52,6 +52,7 @@ $url = parse_url($url); $conn_string = ''; + $schema = ''; // Decode url-encoded information in the db connection string if (isset($url['user'])) { @@ -64,7 +65,10 @@ $conn_string .= ' host='. urldecode($url['host']); } if (isset($url['path'])) { - $conn_string .= ' dbname='. substr(urldecode($url['path']), 1); + $conn_string .= ' dbname='. strtok(urldecode($url['path']), '/'); + // Check for additional schema information if required + $schema = strtok('/'); + } if (isset($url['port'])) { $conn_string .= ' port='. urldecode($url['port']); @@ -85,7 +89,12 @@ // Restore error tracking setting ini_set('track_errors', $track_errors_previous); - pg_query($connection, "set client_encoding=\"UTF8\""); + $query_before_connect = "SET client_encoding='UTF8';" ; + if ($schema) { + $query_before_connect.="SET search_path TO ".$schema ; + } + pg_query($query_before_connect); + return $connection; }