Index: includes/database/pgsql/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/pgsql/database.inc,v
retrieving revision 1.43
diff -u -p -r1.43 database.inc
--- includes/database/pgsql/database.inc	3 Oct 2010 01:29:41 -0000	1.43
+++ includes/database/pgsql/database.inc	1 Nov 2010 11:28:00 -0000
@@ -35,6 +35,15 @@ class DatabaseConnection_pgsql extends D
     if (empty($connection_options['password'])) {
       $connection_options['password'] = NULL;
     }
+    // If the password contains a backslash it is treated as an escape character
+    // http://bugs.php.net/bug.php?id=53217
+    // so backslashes in the password need to be doubled up.
+    // The bug was reported against pdo_pgsql 1.0.2, backslashes in passwords
+    // will break on this doubling up when the bug is fixed, so check the version
+    //elseif (phpversion('pdo_pgsql') < 'version_this_was_fixed_in') {
+    else {
+      $connection_options['password'] = str_replace('\\', '\\\\', $connection_options['password']);
+    }
 
     $this->connectionOptions = $connection_options;
 
