From 640afc74d78add54ef0b1c2ec85afd2c67617a44 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Thu, 23 Feb 2012 21:47:26 -0800 Subject: [PATCH] Use postgres instead of template1 as default database (bug #3491125) --- adminer/drivers/pgsql.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index fec92a29..65fbdbed 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -21,11 +21,11 @@ if (isset($_GET["pgsql"])) { $db = $adminer->database(); set_error_handler(array($this, '_error')); $this->_string = "host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' user='" . addcslashes($username, "'\\") . "' password='" . addcslashes($password, "'\\") . "'"; - $this->_link = @pg_connect("$this->_string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "template1") . "'", PGSQL_CONNECT_FORCE_NEW); + $this->_link = @pg_connect("$this->_string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'", PGSQL_CONNECT_FORCE_NEW); if (!$this->_link && $db != "") { // try to connect directly with database for performance $this->_database = false; - $this->_link = @pg_connect("$this->_string dbname='template1'", PGSQL_CONNECT_FORCE_NEW); + $this->_link = @pg_connect("$this->_string dbname='postgres'", PGSQL_CONNECT_FORCE_NEW); } restore_error_handler(); if ($this->_link) { @@ -53,7 +53,7 @@ if (isset($_GET["pgsql"])) { } function close() { - $this->_link = @pg_connect("$this->_string dbname='template1'"); + $this->_link = @pg_connect("$this->_string dbname='postgres'"); } function query($query, $unbuffered = false) { @@ -132,7 +132,7 @@ if (isset($_GET["pgsql"])) { global $adminer; $db = $adminer->database(); $string = "pgsql:host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' options='-c client_encoding=utf8'"; - $this->dsn("$string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "template1") . "'", $username, $password); + $this->dsn("$string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "postgres") . "'", $username, $password); //! connect without DB in case of an error return true; }