Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1slUYx-0088uZ-DE for pgsql-general@arkaria.postgresql.org; Tue, 03 Sep 2024 14:31:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1slUYv-00CMST-Ip for pgsql-general@arkaria.postgresql.org; Tue, 03 Sep 2024 14:31:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1skqFI-0019Cj-V7 for pgsql-general@lists.postgresql.org; Sun, 01 Sep 2024 19:28:21 +0000 Received: from smtpout04.dka.mailcore.net ([185.138.56.204]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1skqFC-000B5x-EC for pgsql-general@postgresql.org; Sun, 01 Sep 2024 19:28:20 +0000 Received: from SMTP.DKA.mailcore.net (unknown [10.1.0.52]) by SMTPOUT01.DKA.mailcore.net (Postfix) with ESMTP id A79BCE0060 for ; Sun, 1 Sep 2024 21:28:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=online.ee; s=mailcore; t=1725218893; bh=DGeTkBMOBG8ingK0njJn1/T4kd1HqnPb8WoJS5G1b/g=; h=Date:To:From:Subject:From; b=sHI195bU3Xk2w1b886pyaPO4pjMnzHQHLN5Hnwsi/pBDzGQPj909SNgMAVw/IxrVE +oNY6iJe8FXpITbH9vhwtvvhMCBeBzGY25R4J2wH7EQUwEcLgTLpSjOwuIw2VvLtUW jzhUJodo2QEwpPoMASgqHTgywckHYTfzASmlKDw1rXYmf7YWx559xp5Oas9APCk2RZ 1nixuhq6LnSkbjlC+eNlcIEdLTzrDxSof936mbrrhg3zfVCI4fmUZm1Bl8Te5hj+ze hqd/sQiy23S4rZp2HkwtyfW8TT0TuJ/EyJz0J+Mqrm4mUSr9OmPeXXlSMtCOhBIGJB 7z/SZ3aQY1bPw== Received: from [192.168.10.2] (73-142-35-213.sta.estpak.ee [213.35.142.73]) by SMTP.DKA.mailcore.net (Postfix) with ESMTPSA id 862BD40104 for ; Sun, 1 Sep 2024 21:28:13 +0200 (CEST) Content-Type: multipart/alternative; boundary="------------Ygwvb0U59gvsKm00qOw2lOkF" Message-ID: Date: Sun, 1 Sep 2024 22:28:17 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: et To: pgsql-general From: Andrus Subject: How to grant role to other user List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------Ygwvb0U59gvsKm00qOw2lOkF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi! Postgres 16 has user ingmar which is marked as superuser and has create role rights:     CREATE ROLE ingmar WITH       LOGIN       SUPERUSER       INHERIT       CREATEDB       CREATEROLE       NOREPLICATION       BYPASSRLS       ENCRYPTED PASSWORD 'md5aaaaaaa790012b7aa47017f124e263d8';     GRANT "240316_owner" TO ingmar;     GRANT eeva_owner TO ingmar WITH ADMIN OPTION; User ingmar creates role "ingmar.e" using     CREATE ROLE "ingmar.e" LOGIN and tries to grant eeva_owner role to it using     GRANT "eeva_owner" TO "ingmar.e" This command throws error  ERROR: permission denied to grant role "eeva_owner" DETAIL: Only roles with the ADMIN option on role "eeva_owner" may grant this role. How user ingmar can grant role eeva_owner to user  "ingmar.e" ? Using PostgreSQL 16.4 (Debian 16.4-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0 Posted also in https://stackoverflow.com/questions/78938204/how-to-grant-role-to-user Andrus. --------------Ygwvb0U59gvsKm00qOw2lOkF Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi!

Postgres 16 has user ingmar which is marked as superuser and has create role rights:

    CREATE ROLE ingmar WITH
      LOGIN
      SUPERUSER
      INHERIT
      CREATEDB
      CREATEROLE
      NOREPLICATION
      BYPASSRLS
      ENCRYPTED PASSWORD 'md5aaaaaaa790012b7aa47017f124e263d8';
    
    GRANT "240316_owner" TO ingmar;
    GRANT eeva_owner TO ingmar WITH ADMIN OPTION;

User ingmar creates role "ingmar.e" using

    CREATE ROLE "ingmar.e" LOGIN

and tries to grant eeva_owner role to it using

    GRANT "eeva_owner" TO "ingmar.e"

This command throws error

 ERROR: permission denied to grant role "eeva_owner" 

DETAIL: Only roles with the ADMIN option on role "eeva_owner" may grant this role.

How user ingmar can grant role eeva_owner to user  "ingmar.e" ?

Using

PostgreSQL 16.4 (Debian 16.4-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0

Posted also in

https://stackoverflow.com/questions/78938204/how-to-grant-role-to-user

Andrus.


--------------Ygwvb0U59gvsKm00qOw2lOkF--