Skip to content

Commit

Permalink
postgresql - add quotes around user names
Browse files Browse the repository at this point in the history
fix #37114

Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed Mar 7, 2023
1 parent 1f9a822 commit bb04d97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/private/Setup/PostgreSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ private function createDBUser(Connection $connection) {
}

// create the user
$query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'");
$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 = $connection->prepare('GRANT CONNECT ON DATABASE ' . addslashes($this->dbName) . ' TO "' . addslashes($this->dbUser) . '"');
$query->execute();
}
} catch (DatabaseException $e) {
Expand Down

0 comments on commit bb04d97

Please sign in to comment.