This is an automated email from the git hooks/post-receive script.
mbakke pushed a commit to branch master
in repository guix.
The following commit(s) were added to refs/heads/master by this push:
new 221985c services: PostgreSQL: Quote database names.
221985c is described below
commit 221985ce6bd8036ceac3d1973be3dc084f52b1de
Author: Marius Bakke <[email protected]>
AuthorDate: Sat Feb 6 15:18:40 2021 +0100
services: PostgreSQL: Quote database names.
* gnu/services/databases.scm (postgresql-create-roles): Quote the name in
the SQL query so that roles/usernames containing hyphens will work.
---
gnu/services/databases.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index c118986..d908b86 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -396,12 +396,12 @@ and stores the database cluster in @var{data-directory}."
rolname = '" ,name "')) as not_exists;\n"
"\\gset\n"
"\\if :not_exists\n"
-"CREATE ROLE " ,name
+"CREATE ROLE \"" ,name "\""
" WITH " ,(format-permissions permissions)
";\n"
,@(if create-database?
- `("CREATE DATABASE " ,name
- " OWNER " ,name ";\n")
+ `("CREATE DATABASE \"" ,name "\""
+ " OWNER \"" ,name "\";\n")
'())
"\\endif\n")))
roles)))