How to grant role to other user

From: Andrus <kobruleht2(at)hot(dot)ee>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: How to grant role to other user
Date: 2024-09-01 19:28:17
Message-ID: a1b5e303-66f9-4992-9d9b-0213c1c6bef7@hot.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Luzanov 2024-09-01 21:44:40 PG17 optimizations to vacuum
Previous Message Adrian Klaver 2024-09-01 16:22:31 Re: Upgrade Ubuntu 22 -> 24 may break PostgreSQL