]> git.joonet.de Git - adminer.git/commitdiff
Use postgres instead of template1 as default database (bug #3491125)
authorJakub Vrana <jakub@vrana.cz>
Fri, 24 Feb 2012 05:47:26 +0000 (21:47 -0800)
committerJakub Vrana <jakub@vrana.cz>
Fri, 24 Feb 2012 06:58:40 +0000 (22:58 -0800)
adminer/drivers/pgsql.inc.php

index fec92a295a91a0016fe5d9a8fd7238738247f7b7..65fbdbedb34d9d9977de73bb4eecbee27a371d57 100644 (file)
@@ -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;
                        }