From 221985ce6bd8036ceac3d1973be3dc084f52b1de Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sat, 6 Feb 2021 15:18:40 +0100 Subject: 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(-) (limited to 'gnu/services') 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 @@ (define (roles->queries roles) 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))) -- cgit v1.2.3