From unknown Wed Jun 18 23:04:37 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#62495 <62495@debbugs.gnu.org> To: bug#62495 <62495@debbugs.gnu.org> Subject: Status: [PATCH] services: postgresql: Add more role fields. Reply-To: bug#62495 <62495@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:04:37 +0000 retitle 62495 [PATCH] services: postgresql: Add more role fields. reassign 62495 guix-patches submitter 62495 Miguel Moreno severity 62495 normal tag 62495 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 28 03:17:00 2023 Received: (at submit) by debbugs.gnu.org; 28 Mar 2023 07:17:00 +0000 Received: from localhost ([127.0.0.1]:48774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ph3Zj-0002LC-NL for submit@debbugs.gnu.org; Tue, 28 Mar 2023 03:17:00 -0400 Received: from lists.gnu.org ([209.51.188.17]:37348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgqgJ-0005wM-PY for submit@debbugs.gnu.org; Mon, 27 Mar 2023 13:30:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgqgJ-0004Xi-Gl for guix-patches@gnu.org; Mon, 27 Mar 2023 13:30:55 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgqgG-00011f-Ej for guix-patches@gnu.org; Mon, 27 Mar 2023 13:30:55 -0400 Received: (Authenticated sender: mmoreno@mmoreno.eu) by mail.gandi.net (Postfix) with ESMTPSA id 6E7C640005 for ; Mon, 27 Mar 2023 17:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mmoreno.eu; s=gm1; t=1679938247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=olxnPa4iPnjkMOewCTtv6KGMdq5Rf2lHGMFBfXGO9FY=; b=JeeGdQWRHiajc32jXh7IFkKfsnwxNM2odttY78uzS796f/BislJ+KfuHZG4QDjBkT2BM0N cMPGRHtu3uAuQp4FVOvzm2HgaC34Xo+4J3jFT5AyY0DMMFsL+ILKJBxs/xb5tOo5tdZeqQ nzF+OQmMbnPpix+cNakzoxf1DX5R1064HOxKSmpIFWRTxj0I6iOmwii8Rt/ct8EyNveaCS ihmo3cxtKhg0MvFobRaZ7THVnxRkjSEcFL/tZIL4oUAahV04QFVto48nXllZ+I9hzC7P5b 5ScUzkBRWXAq7S3gWvn95A9q6p4MoNc0KH8QjHkMXpArO1Hi1JjYZAz2/ebVHQ== From: Miguel Moreno To: guix-patches@gnu.org Subject: [PATCH] services: postgresql: Add more role fields. Date: Mon, 27 Mar 2023 19:30:45 +0200 Message-ID: <86tty6rtiy.fsf@mmoreno.eu> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=217.70.183.194; envelope-from=mmoreno@mmoreno.eu; helo=relay2-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 28 Mar 2023 03:16:57 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) * gnu/services/databases.scm (postgresql-role): Add more role fields. (postgresql-create-roles): Honor it. * doc/guix.texi (Database Services): Document it. --- doc/guix.texi | 16 +++++++++++++++- gnu/services/databases.scm | 19 ++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index c49e51b72e..79d6f78e02 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24635,7 +24635,21 @@ Database Services @code{superuser}. @item @code{create-database?} (default: @code{#f}) -Whether to create a database with the same name as the role. +whether to create a database with the same name as the role. + +@item @code{encoding} (default: @code{"UTF8"}) +The character set to use for storing text in the database. + +@item @code{collation} (default: @code{"en_US.utf8"}) +The string sort order locale setting. + +@item @code{ctype} (default: @code{"en_US.utf8"}) +The character classification locale setting. + +@item @code{template} (default: @code{"template1"}) +The default template to copy the new database from when creating it. +Use @code{"template0"} for a pristine database with no system-local +modifications. @end table @end deftp diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index b7bd1e587e..9867e4db0c 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -362,7 +362,15 @@ (define-record-type* (permissions postgresql-role-permissions (default '(createdb login))) ;list (create-database? postgresql-role-create-database? ;boolean - (default #f))) + (default #f)) + (encoding postgresql-role-encoding ;string + (default "UTF8")) + (collation postgresql-role-collation ;string + (default "en_US.utf8")) + (ctype postgresql-role-ctype ;string + (default "en_US.utf8")) + (template postgresql-role-template ;string + (default "template1"))) (define-record-type* postgresql-role-configuration make-postgresql-role-configuration @@ -391,7 +399,8 @@ (define (postgresql-create-roles config) (append-map (lambda (role) (match-record role - (name permissions create-database?) + (name permissions create-database? encoding collation ctype + template) `("SELECT NOT(EXISTS(SELECT 1 FROM pg_catalog.pg_roles WHERE \ rolname = '" ,name "')) as not_exists;\n" "\\gset\n" @@ -401,7 +410,11 @@ (define (postgresql-create-roles config) ";\n" ,@(if create-database? `("CREATE DATABASE \"" ,name "\"" - " OWNER \"" ,name "\";\n") + " OWNER \"" ,name "\"\n" + " ENCODING '" ,encoding "'\n" + " LC_COLLATE '" ,collation "'\n" + " LC_CTYPE '" ,ctype "'\n" + " TEMPLATE " ,template ";") '()) "\\endif\n"))) roles))) -- 2.39.2 -- Best regards, Miguel Moreno From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 10 18:28:26 2023 Received: (at 62495-done) by debbugs.gnu.org; 10 Aug 2023 22:28:26 +0000 Received: from localhost ([127.0.0.1]:44220 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUE8o-0003EE-GI for submit@debbugs.gnu.org; Thu, 10 Aug 2023 18:28:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUE8l-0003E1-Lu for 62495-done@debbugs.gnu.org; Thu, 10 Aug 2023 18:28:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUE8f-0002nH-B7; Thu, 10 Aug 2023 18:28:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=2i6j4CYaa6VK+2l4US1nqKNH74mdPhZgUeTvz4RkQjc=; b=HarIz0IP7o7wdmfPftVf shz1ficfxD6qGYWgd/spSkg9L/chgVbCZ3YaqP8nyTm/VebjDniu3/r6DDGDdvPMSNrf/jnKZXke7 ojzzao0L28d3UyvdxqYqe3TaIkERZH0hAbJYE1z0yACTxTygyEged3pRZFJvxJmkWFHr47wGig99t VNC9P4hQzymcPw0+/w01PLzylP70W5pQ1EuCVSQDPBEEOPKnazC8GQmyVFkd5U5FKqGadc6A9JvEh edKMRDQTbhzP5ywPpykuBrWapyJh2AhBTDscLDlOiBo1PI+Gdv/mudqnL7EiHbzjMfZYtImJwUxWU 6W9Nd2K27cwqVw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Miguel Moreno Subject: Re: bug#62495: [PATCH] services: postgresql: Add more role fields. References: <86tty6rtiy.fsf@mmoreno.eu> Date: Fri, 11 Aug 2023 00:28:14 +0200 In-Reply-To: <86tty6rtiy.fsf@mmoreno.eu> (Miguel Moreno's message of "Mon, 27 Mar 2023 19:30:45 +0200") Message-ID: <87cyzuilc1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62495-done Cc: 62495-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Miguel Moreno skribis: > * gnu/services/databases.scm (postgresql-role): Add more role fields. > (postgresql-create-roles): Honor it. > * doc/guix.texi (Database Services): Document it. Finally applied, thanks! Ludo=E2=80=99. From unknown Wed Jun 18 23:04:37 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 08 Sep 2023 11:24:13 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator