From 4ebd411cee00055b5f16cd29d493da2ffdc38c21 Mon Sep 17 00:00:00 2001 From: Paul dG Date: Wed, 29 Apr 2015 18:02:38 +0200 Subject: [PATCH] template1 as default database for Postgres Fixes #402 (https://github.com/doctrine/DoctrineBundle/issues/402) by connecting by default to 'template1' instead of the database with the same name as the user (Postgre default in case of no dbname). --- lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php b/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php index 5da59d528b9..a12aa0d587e 100644 --- a/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php +++ b/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php @@ -60,6 +60,9 @@ private function _constructPdoDsn(array $params) if (isset($params['dbname'])) { $dsn .= 'dbname=' . $params['dbname'] . ' '; } + else { + $dsn .= 'dbname=template1' . ' '; + } return $dsn; }