pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: m.kristo@rewe-group.at
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18389: pg_database_owner not recognized with alter default privileges
Date: Wed, 13 Mar 2024 09:44:16 +0100
Message-ID: <5367558c2cfc467d6462c8962c57282bba9c0321.camel@cybertec.at> (raw)
In-Reply-To: <18389-8ad7f569523f579b@postgresql.org>
References: <18389-8ad7f569523f579b@postgresql.org>

On Tue, 2024-03-12 at 19:04 +0000, PG Bug reporting form wrote:
> i am precreating schemas in template1 database and setting specific
> privileges.
> When performing "alter default privileges for role pg_database_owner ..."
> the group is recognized and the default privilege is also set. No error is
> thrown. 
> 
> When i create a new database the pg_database_owner role is not working
> correctly. I created then the same privilege with specifying the db owner
> and then the privilege works.

It is working here:

  ALTER DEFAULT PRIVILEGES FOR ROLE pg_database_owner
     GRANT SELECT ON TABLES TO laurenz;

  SET ROLE pg_database_owner;

  CREATE TABLE mumble ();

  \dp mumble
                                            Access privileges
   Schema │  Name  │ Type  │              Access privileges              │ Column privileges │ Policies 
  ════════╪════════╪═══════╪═════════════════════════════════════════════╪═══════════════════╪══════════
   public │ mumble │ table │ pg_database_owner=arwdDxt/pg_database_owner↵│                   │ 
          │        │       │ laurenz=r/pg_database_owner                 │                   │ 
  (1 row)

Note that you have to be role "pg_database_owner" (see the SET ROLE statement).
It is not sufficient to be the owner of the database (the only implicit member
of that role).

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com


view thread (5+ messages)  latest in thread

Message-ID: <5367558c2cfc467d6462c8962c57282bba9c0321.camel@cybertec.at>
Permalink:  ../5367558c2cfc467d6462c8962c57282bba9c0321.camel@cybertec.at/
Also on:    postgresql.org/message-id/5367558c2cfc467d6462c8962c57282bba9c0321.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: laurenz.albe@cybertec.at, m.kristo@rewe-group.at
  Subject: Re: BUG #18389: pg_database_owner not recognized with alter default privileges
  In-Reply-To: <5367558c2cfc467d6462c8962c57282bba9c0321.camel@cybertec.at>
  References: <18389-8ad7f569523f579b@postgresql.org> <5367558c2cfc467d6462c8962c57282bba9c0321.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox