summaryrefslogtreecommitdiffstats
path: root/lib/private/Setup
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Setup')
-rw-r--r--lib/private/Setup/PostgreSQL.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php
index 283ab5f925c..6d1b5ca2927 100644
--- a/lib/private/Setup/PostgreSQL.php
+++ b/lib/private/Setup/PostgreSQL.php
@@ -154,6 +154,10 @@ class PostgreSQL extends AbstractDatabase {
// create the user
$query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'");
$query->execute();
+ if ($this->databaseExists($connection)) {
+ $query = $connection->prepare('GRANT CONNECT ON DATABASE ' . addslashes($this->dbName) . ' TO '.addslashes($this->dbUser));
+ $query->execute();
+ }
} catch (DatabaseException $e) {
$this->logger->error('Error while trying to create database user');
$this->logger->logException($e);