--- install.pgsql.inc.orig	2009-08-31 20:23:09.000000000 +0200
+++ install.pgsql.inc	2009-08-31 20:27:50.000000000 +0200
@@ -35,15 +35,19 @@
   if (isset($url['pass'])) {
     $conn_string .= ' password='. urldecode($url['pass']);
   }
-  if (isset($url['host'])) {
+  if ($url['host'] == "localhost") {
+    if (isset($url['port'])) {
+      $conn_string .= ' host='. urldecode($url['host']). ' port='. urldecode($url['port']);
+    }
+  } else {
     $conn_string .= ' host='. urldecode($url['host']);
+    if (isset($url['port'])) {
+      $conn_string .= ' port='. urldecode($url['port']);
+    }
   }
   if (isset($url['path'])) {
     $conn_string .= ' dbname='. substr(urldecode($url['path']), 1);
   }
-  if (isset($url['port'])) {
-    $conn_string .= ' port='. urldecode($url['port']);
-  }
 
   // Test connecting to the database.
   $connection = @pg_connect($conn_string);
