Permalink
Browse files

[ticket/10828] Connect to postgres database by default.

When not connecting to a specific database, connect to postgres
database which specifically exists as a default database to
connect to.

PHPBB3-10828
  • Loading branch information...
1 parent a97ebe7 commit 9fa7ab62ad45abf3a5035cc792748893d6cd8a4d @p p committed May 22, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/test_framework/phpbb_database_test_connection_manager.php
@@ -80,6 +80,21 @@ public function connect($use_db = true)
{
$dsn .= ';dbname=' . $this->config['dbname'];
}
+ else if ($this->dbms['PDO'] == 'pgsql')
+ {
+ // Postgres always connects to a
+ // database. If the database is not
+ // specified here, but the username
+ // is specified, then connection
+ // will be to the database named
+ // as the username.
+ //
+ // For greater compatibility, connect
+ // instead to postgres database which
+ // should always exist:
+ // http://www.postgresql.org/docs/9.0/static/manage-ag-templatedbs.html
+ $dsn .= ';dbname=postgres';
+ }
break;
}

0 comments on commit 9fa7ab6

Please sign in to comment.