--- ../../../../../../tmp/kde-brenda/cervisialo8m6b-install.pgsql.inc-HEAD	2007-04-14 15:37:42.000000000 +1200
+++ install.pgsql.inc	2007-04-14 15:37:27.000000000 +1200
@@ -3,6 +3,8 @@
 
 // PostgreSQL specific install functions
 
+require('database.pgsql.inc');
+
 /**
  * Check if PostgreSQL is available.
  *
@@ -25,20 +27,8 @@
     return FALSE;
   }
 
-  $url = parse_url($url);
-
-  // Decode url-encoded information in the db connection string.
-  $url['user'] = urldecode($url['user']);
-  $url['pass'] = urldecode($url['pass']);
-  $url['host'] = urldecode($url['host']);
-  $url['path'] = urldecode($url['path']);
-
-  // Build pgsql connection string and allow for non-standard PostgreSQL port.
-  $conn_string = ' user='. $url['user'] .' dbname='. substr($url['path'], 1) .' password='. $url['pass'] .' host='. $url['host'];
-  $conn_string .= isset($url['port']) ? ' port='. $url['port'] : '';
-
-  // Test connecting to the database.
-  $connection = @pg_connect($conn_string);
+// Test connecting to the database.
+  $connection = db_connect($url);
   if (!$connection) {
     drupal_set_message(st('Failure to connect to your PostgreSQL database server. PostgreSQL reports the following message: %error.<ul><li>Are you sure you have the correct username and password?</li><li>Are you sure that you have typed the correct database hostname?</li><li>Are you sure that the database server is running?</li><li>Are you sure you typed the correct database name?</li></ul>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%error' => 'Connection failed. See log file for failure reason')), 'error');
     return FALSE;
