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.96) (envelope-from ) id 1vT71F-00DDwv-2h for pgsql-admin@arkaria.postgresql.org; Tue, 09 Dec 2025 23:21:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vT71E-008Ox3-1L for pgsql-admin@arkaria.postgresql.org; Tue, 09 Dec 2025 23:21:20 +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.96) (envelope-from ) id 1vT71E-008Owv-0A for pgsql-admin@lists.postgresql.org; Tue, 09 Dec 2025 23:21:20 +0000 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vT71C-0048uO-0A for pgsql-admin@lists.postgresql.org; Tue, 09 Dec 2025 23:21:20 +0000 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-3ec6c10a295so2309953fac.0 for ; Tue, 09 Dec 2025 15:21:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765322476; x=1765927276; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6KHVaE2b0SBu2KkhvK3iKJrlaw/nyp/ZLgUQ2dww9hA=; b=hSZnukgcljDxS+ZnDRQ7b1rIPw/5X4jKlCHqZ12C/JfB83rnYs/2sAuI8wY8Kt8LZN TUpmLjmyYzuWtYnjJ8mxflD6tHU4S1syXgGfYC+qZLVTS+Wgw0/JqSRGOverFs5aIrEj js2EG4WrmEgEOvYZLinrP2OaG7PST/smGKn7zbKcsKV+cNAbij8mXfAvY+4+jDoCNiGI GR9HYFGbZegtjZ1SCDTtgvAkWD2jF4I2t7Ooj93KurE4sjyHWgx1A66fyo2RN28FeMXn z6832L1AJO4e3lq5ZnIVWi775LfazSCMu5JA6MlR5nv95beLnuCeoWO2RmBSd3lgiqvO 1ROQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765322476; x=1765927276; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6KHVaE2b0SBu2KkhvK3iKJrlaw/nyp/ZLgUQ2dww9hA=; b=a9UT5UW6JK95Nn2GNnTCJoX8VCX0Yl+i+NOgiJkBc+hxzyiSIByXJCNfYFDTer6lMr tHYaZNUoefjeThsY61VU2aMUFyn91zwHvNssiEy503QBqJ8K+KDkbk1+H6M4CgIJMXKa DrKzkhcwVnUh6HMukUn0JwHpNRfNhM4Tc34qlS7DNeHuBhufw2jMsm3PFxBAFDpmW39j zvqhQ/gJMzQPGP4UCDzI/Kke7xEVjhk/x1kAqXacS9l+qJsvtW06ATGn/tbpTVvNSt0p hVk6d2BlM40MNCsxpEkpTaYwzfacUD/CS84lEezJ+s/JdzYAUTeFt74KsJ9aWiDjn4ha JeaA== X-Gm-Message-State: AOJu0YyD7Rh2vrCdieL5hYBOodY6i58RMAQ3xoF4dFrJLvFhU0mjOTw1 XD01puvM6JT7ekjm51s9SXgAV5f0+O02nF2DxPZm/w5GAuE41yrSQdeJh/FJXbIT9HAvyas8ZT5 Bn7rZ3d/9NlqE4cWFKP6myUMN3sJFyvk= X-Gm-Gg: AY/fxX4NgmTBD8JCPKHuYDZItqa1JtEly9qSwHMI6QIXdLxaRVJnH6KVD4YNUYUACyb CHbdBNxrDFcNZoHtHtt8alQCEr3eiuekgYhYJ8PBuQkPHjwyGEfsuSBEH6Qyk6V/RAZB2S27cLQ zDgL7hjgJz5zrbfyotztGFUmjnkgp14pBK7/Tzhk6+uFjKgX1UAdhG1eK28b5NZs7cp7AS0j5Ih keo95lfHOktktyUGNRbxAdZoTHvMVybwX53WypptD5W9EOU7+i2Mom6+DKoUgKUIVlT5VTwtq7+ rfBTXx5qZ9JsI/WaRrNwqzZgyRBdEnpR2UUc139Unxww7J16QAR+rFpW X-Google-Smtp-Source: AGHT+IF8sqYBwyTbt+kfolJNH4a1mTsUixxvu5TkN82xGcpsNbylK+/COEKR+VrKu/t95z/z53Q/pCBJuL2/J8mr74E= X-Received: by 2002:a05:6870:e2cd:b0:3e7:f4a9:588b with SMTP id 586e51a60fabf-3f5bd89bc71mr379625fac.15.1765322476175; Tue, 09 Dec 2025 15:21:16 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: richard coleman Date: Tue, 9 Dec 2025 18:21:05 -0500 X-Gm-Features: AQt7F2pcdKLIz8sHWkCDIcxXwy-tbNgcDku6HOmIgyhbO4Tf2aoX0D8L_IlbgN8 Message-ID: Subject: Re: database specific pg_read_all_data / pg_write_all_data To: Ron Johnson Cc: Pgsql-admin Content-Type: multipart/alternative; boundary="0000000000001b467606458d2b84" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001b467606458d2b84 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ron, That wouldn't come even close to what pg_read_all_data grants. A role assigned to pg_read_all_data automatically has the ability to read everything, in every schema that exists now or in the future. The old way, your suggestion, means that you have to keep rerunning that command everytime someone creates a schema, creates a table, creates a view, recreates a table, recreates a view, etc. for all eternity. Not only that, you have to tailor the command to each new schema, etc. This makes shared privs much more streamlined and removes the chance that a user will forget to assign privs to objects that they create. I hope that helps make it clearer. rik. On Tue, Dec 9, 2025 at 5:46=E2=80=AFPM Ron Johnson wrote: > On Tue, Dec 9, 2025 at 4:13=E2=80=AFPM richard coleman < > rcoleman.ascentgl@gmail.com> 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. >> > > How about > ALTER DEFAULT PRIVILEGES IN SCHEMA foo1, foo2, foo3, ... GRANT SELECT ON > ALL TABLE TO bar; > > -- > Death to , and butter sauce. > Don't boil me, I'm still alive. > lobster! > --0000000000001b467606458d2b84 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ron,

That wouldn't come even close = to what pg_read_all_data grants.
A role assigned to pg_read_all_d= ata automatically has the ability to read everything, in every schema that = exists now or in the future.

The old way, your sug= gestion, means that you have to keep rerunning that command everytime someo= ne creates a schema, creates a table, creates a view, recreates a table, re= creates a view, etc. for all eternity.=C2=A0 Not only that, you have to tai= lor the command to each new schema, etc.

This make= s shared privs much more streamlined and removes the chance that a user wil= l forget to assign privs to objects that they create.

<= div>I hope that helps make it clearer.
rik.

<= div>


On Tue, Dec 9, 2025 at 5= :46=E2=80=AFPM Ron Johnson <r= onljohnsonjr@gmail.com> wrote:
On Tue, Dec 9, 2025= at 4:13=E2=80=AFPM richard coleman <rcoleman.ascentgl@gmail.com> wrote:
In PostgreSQL 16+ the built in roles such as=C2=A0pg_= read_all_data and=C2=A0pg_write_all_data are a welcome addition to permissi= on setting in PostgreSQL.

Unfortunately they appear to b= e server-wide roles.

Woud it be possible to have r= oles like these that are database specific?

If the= re are 100 databases on a server, it would be extremely helpful to be able = to do something like:

grant pg_read_all_dat= a on database foo to user_role;

Otherwise these roles are unusable from a practical stand point on serve= rs with multiple unrelated databases.

How about=C2=A0
ALTER=C2=A0DEFAULT PRIVIL= EGES IN SCHEMA foo1, foo2, foo3, ... GRANT SELECT ON ALL TABLE TO bar;

--
Death to <Redacted= >, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
--0000000000001b467606458d2b84--