From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add a run_as_owner option to subscriptions.
Date: Tue, 04 Apr 2023 16:09:12 +0000
Message-ID: <E1pjjDb-001LR8-2S@gemulon.postgresql.org> (raw)
Add a run_as_owner option to subscriptions.
This option is normally false, but can be set to true to obtain
the legacy behavior where the subscription runs with the permissions
of the subscription owner rather than the permissions of the
table owner. The advantages of this mode are (1) it doesn't require
that the subscription owner have permission to SET ROLE to each
table owner and (2) since no role switching occurs, the
SECURITY_RESTRICTED_OPERATION restrictions do not apply.
On the downside, it allows any table owner to easily usurp
the privileges of the subscription owner - basically, to take
over their account. Because that's generally quite undesirable,
we don't make this mode the default, but we do make it available,
just in case the new behavior causes too many problems for someone.
Discussion: http://postgr.es/m/CA+TgmoZ-WEeG6Z14AfH7KhmpX2eFh+tZ0z+vf0=eMDdbda269g@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/482675987bcdffb390ae735cfd5f34b485ae97c6
Modified Files
--------------
doc/src/sgml/logical-replication.sgml | 17 ++
doc/src/sgml/ref/alter_subscription.sgml | 3 +-
doc/src/sgml/ref/create_subscription.sgml | 14 ++
src/backend/catalog/pg_subscription.c | 1 +
src/backend/catalog/system_views.sql | 2 +-
src/backend/commands/subscriptioncmds.c | 23 ++-
src/backend/replication/logical/worker.c | 46 +++--
src/bin/psql/describe.c | 8 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_subscription.h | 4 +
src/test/regress/expected/subscription.out | 144 +++++++--------
src/test/subscription/t/033_run_as_table_owner.pl | 204 ++++++++++++++++++++++
12 files changed, 376 insertions(+), 92 deletions(-)
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: pgsql-committers@postgresql.org
Cc: rhaas@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add a run_as_owner option to subscriptions.
In-Reply-To: <E1pjjDb-001LR8-2S@gemulon.postgresql.org>
* 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