pgsql: Validate subscription conninfo on owner change

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Validate subscription conninfo on owner change
Date: 2026-07-23 10:27:29
Message-ID: E1wmqeH-00000000QIv-38mt@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Validate subscription conninfo on owner change

For subscriptions using SERVER, changing the owner can change the
effective connection string. However, ALTER SUBSCRIPTION ... OWNER TO
did not validate the generated conninfo for the new owner.

As a result, ownership could be transferred to a non-superuser whose
generated connection string did not satisfy password_required=true.
The ownership change succeeded, but the subscription would fail later
when the worker or another command tried to connect.

Fix this by making ALTER SUBSCRIPTION ... OWNER TO validate the new
owner's generated conninfo with walrcv_check_conninfo().

Backpatch to v19, where SERVER subscriptions were introduced.

Author: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Yuanchao Zhang <145zhangyc(at)gmail(dot)com>
Reviewed-by: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Discussion: https://postgr.es/m/CAHGQGwFGa6+wWVgUmZPFwN=fBY59mYPkMK3=TxT=Pv5C1mNNRQ@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/41be67e534ffccd055922482c17b874fb7a74f30

Modified Files
--------------
doc/src/sgml/ref/alter_subscription.sgml | 7 +++++++
src/backend/commands/subscriptioncmds.c | 14 ++++++++++++--
src/test/regress/expected/subscription.out | 17 +++++++++++++++++
src/test/regress/regress.c | 9 +++++++++
src/test/regress/sql/subscription.sql | 16 ++++++++++++++++
5 files changed, 61 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-07-24 06:47:26 pgsql: Fix EXCEPT publication test to check subscriber
Previous Message Fujii Masao 2026-07-23 10:27:14 pgsql: doc: Improve pg_stat_recovery documentation