public inbox for [email protected]  
help / color / mirror / Atom feed
From: richard coleman <[email protected]>
To: Laurenz Albe <[email protected]>
Cc: Pgsql-admin <[email protected]>
Subject: Re: database specific pg_read_all_data / pg_write_all_data
Date: Wed, 10 Dec 2025 08:06:17 -0500
Message-ID: <CAGA3vBuWjNdz=zfMNvpqYRJRdQCapbexWnD4kgOss2PMbw5ZZw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAGA3vBug6Sq_XYLxzmY470WFS6Z3OF28goYzX=QHrCc4hgQSDw@mail.gmail.com>
	<[email protected]>

Laurenz,

Multiple clusters would be nice, but we don't have the available servers to
accomodate that.
Without the pg_read_all_data role there is apparently no other way in
PostgreSQL to automatically assign these privs to each and every table/view
that exists or will be created without using the nuclear option and
granting super user privs.  Unless there is something else that I am
missing which could be used when creating your suggested "readonly_dbname"
role.

It's a shame that PostgreSQL has created some extremely useful built in
roles, but then limits them such that they can only be utilized for
vanishingly few actual use cases.

Hopefully the PostgreSQL devs revisit these built in roles with a thought
toward making database specific ones assignable  with a mechanism like:

*grant *pg_read_all_data* on database *foo* to *user_role*;*

Thanks,
rik.



On Wed, Dec 10, 2025 at 5:01 AM Laurenz Albe <[email protected]>
wrote:

> On Tue, 2025-12-09 at 16:13 -0500, richard coleman wrote:
> > In PostgreSQL 16+ the built in roles such as pg_read_all_data
> and pg_write_all_data are a welcome addition to permission setting in
> PostgreSQL.
> >
> > Unfortunately they appear to be server-wide roles.
> >
> > Woud it be possible to have roles like these that are database specific?
> >
> > If there are 100 databases on a server, it would be extremely helpful to
> be able to do something like:
> >
> > grant pg_read_all_data on database foo to user_role;
> >
> > Otherwise these roles are unusable from a practical stand point on
> servers with multiple unrelated databases.
>
> I think they were mostly added for compatibility with Microsoft SQL Server,
> if I remember correctly.
>
> I suggest creating roles named "readonly_dbname" for each database with
> the appropriate privileges and assigning those.
>
> A different approach would be to use different database clusters for
> different
> databases.
>
> Yours,
> Laurenz Albe
>


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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: database specific pg_read_all_data / pg_write_all_data
  In-Reply-To: <CAGA3vBuWjNdz=zfMNvpqYRJRdQCapbexWnD4kgOss2PMbw5ZZw@mail.gmail.com>

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

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