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 <[email protected]>
Reviewed-by: Shlok Kyal <[email protected]>
Reviewed-by: Masahiko Sawada <[email protected]>
Reviewed-by: Amit Kapila <[email protected]>
Discussion:
https://postgr.es/m/[email protected]
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(-)