pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: CREATE SUBSCRIPTION ... SERVER.
Date: Fri, 06 Mar 2026 16:44:00 +0000
Message-ID: <E1vyYHQ-002hOV-0R@gemulon.postgresql.org> (raw)

CREATE SUBSCRIPTION ... SERVER.

Allow CREATE SUBSCRIPTION to accept a foreign server using the SERVER
clause instead of a raw connection string using the CONNECTION clause.

  * Enables a user with sufficient privileges to create a subscription
    using a foreign server by name without specifying the connection
    details.

  * Integrates with user mappings (and other FDW infrastructure) using
    the subscription owner.

  * Provides a layer of indirection to manage multiple subscriptions
    to the same remote server more easily.

Also add CREATE FOREIGN DATA WRAPPER ... CONNECTION clause to specify
a connection_function. To be eligible for a subscription, the foreign
server's foreign data wrapper must specify a connection_function.

Add connection_function support to postgres_fdw, and bump postgres_fdw
version to 1.3.

Bump catversion.

Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/61831790a0a937038f78ce09f8dd4cef7de7456a.camel@j-davis.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8185bb53476378443240d57f7d844347d5fae1bf

Modified Files
--------------
contrib/postgres_fdw/Makefile                     |   2 +-
contrib/postgres_fdw/connection.c                 | 299 +++++++++++++---------
contrib/postgres_fdw/expected/postgres_fdw.out    |   8 +
contrib/postgres_fdw/meson.build                  |   2 +
contrib/postgres_fdw/postgres_fdw--1.2--1.3.sql   |  12 +
contrib/postgres_fdw/postgres_fdw.control         |   2 +-
contrib/postgres_fdw/sql/postgres_fdw.sql         |   7 +
contrib/postgres_fdw/t/010_subscription.pl        |  71 +++++
doc/src/sgml/logical-replication.sgml             |   4 +-
doc/src/sgml/postgres-fdw.sgml                    |  26 ++
doc/src/sgml/ref/alter_foreign_data_wrapper.sgml  |  20 ++
doc/src/sgml/ref/alter_subscription.sgml          |  18 +-
doc/src/sgml/ref/create_foreign_data_wrapper.sgml |  20 ++
doc/src/sgml/ref/create_server.sgml               |   7 +
doc/src/sgml/ref/create_subscription.sgml         |  16 +-
src/backend/catalog/dependency.c                  |  11 +
src/backend/catalog/pg_subscription.c             |  38 ++-
src/backend/catalog/system_views.sql              |   2 +-
src/backend/commands/foreigncmds.c                |  58 ++++-
src/backend/commands/subscriptioncmds.c           | 203 +++++++++++++--
src/backend/foreign/foreign.c                     |  86 +++++++
src/backend/parser/gram.y                         |  22 ++
src/backend/replication/logical/worker.c          |  24 +-
src/bin/pg_dump/pg_dump.c                         |  39 ++-
src/bin/pg_dump/pg_dump.h                         |   1 +
src/bin/psql/describe.c                           |   6 +-
src/bin/psql/tab-complete.in.c                    |  11 +-
src/include/catalog/catversion.h                  |   2 +-
src/include/catalog/pg_foreign_data_wrapper.h     |   3 +
src/include/catalog/pg_subscription.h             |   8 +-
src/include/foreign/foreign.h                     |   3 +
src/include/nodes/parsenodes.h                    |   3 +
src/test/regress/expected/oidjoins.out            |   2 +
src/test/regress/expected/subscription.out        | 222 +++++++++-------
src/test/regress/regress.c                        |   7 +
src/test/regress/sql/subscription.sql             |  55 ++++
36 files changed, 1070 insertions(+), 250 deletions(-)



view thread (9+ messages)  latest in thread

Message-ID: <E1vyYHQ-002hOV-0R@gemulon.postgresql.org>
Permalink:  ../E1vyYHQ-002hOV-0R@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vyYHQ-002hOV-0R@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: CREATE SUBSCRIPTION ... SERVER.
  In-Reply-To: <E1vyYHQ-002hOV-0R@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