Index: includes/database.pgsql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v retrieving revision 1.68 diff -u -r1.68 database.pgsql.inc --- includes/database.pgsql.inc 4 Jan 2008 09:31:48 -0000 1.68 +++ includes/database.pgsql.inc 17 Jan 2008 11:56:03 -0000 @@ -52,8 +52,12 @@ $url = parse_url($url); $conn_string = ''; + $schema = ''; // Decode url-encoded information in the db connection string + // Syntax is 'pgsql://username:password@localhost/databasename' + // or 'pgsql://username:password@localhost/databasename/schema' if (isset($url['user'])) { $conn_string .= ' user='. urldecode($url['user']); } @@ -64,7 +68,9 @@ $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,6 +91,11 @@ // Restore error tracking setting ini_set('track_errors', $track_errors_previous); + if ($schema !== '') { + @pg_query($connection, 'SET search_path TO '. $schema); + } + return $connection; }