aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2021-02-06 15:18:40 +0100
committerMarius Bakke <marius@gnu.org>2021-02-06 15:18:40 +0100
commit221985ce6bd8036ceac3d1973be3dc084f52b1de (patch)
tree70f5af662fcc2bb7c1d54e8fd36689597bc6d617 /gnu
parente6554523afb83eb8be913e45c9c6f7a324a4e2bf (diff)
downloadguix-221985ce6bd8036ceac3d1973be3dc084f52b1de.tar
guix-221985ce6bd8036ceac3d1973be3dc084f52b1de.tar.gz
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.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/databases.scm6
1 files changed, 3 insertions, 3 deletions
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index c11898693f..d908b86af8 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)))