On Sat, Jan 10, 2026 at 8:55 PM Jeff Davis <pgsql@j-davis.com> wrote:
>
> On Fri, 2025-12-26 at 13:52 -0800, Jeff Davis wrote:
> > On Wed, 2025-04-02 at 17:58 +0530, Shlok Kyal wrote:
> > > I reviewed the patch and I have a comment:
> > >
> > > If version is >=18, the query will have 'suboriginremotelsn',
> > > 'subenabled', 'subfailover' twice.
> >
> > Thank you. Fixed and rebased.
>
> Attached new version with significant changes:
>
> - fixed several issues (including some improper merges in the last
> rebase)
> - refactored to share code between postgres_fdw_connection() and
> connect_pg_server()
> - added docs in postgres_fdw
> - added tests in core
> - bumped postgres_fdw version to 1.3
>
I've reviewed the latest patch set. I understand the motivation behind
this proposal and find it useful. Here are some comments:
@@ -5580,6 +5580,8 @@ fdw_option:
| NO HANDLER { $$ =
makeDefElem("handler", NULL, @1); }
| VALIDATOR handler_name { $$ =
makeDefElem("validator", (Node *) $2, @1); }
| NO VALIDATOR { $$ =
makeDefElem("validator", NULL, @1); }
+ | CONNECTION handler_name { $$ =
makeDefElem("connection", (Node *) $2, @1); }
+ | NO CONNECTION { $$ =
makeDefElem("connection", NULL, @1); }
;
The documentation for ALTER FOREIGN DATA WRAPPER needs to be updated.
---
The security section[1] of logical replication chapter would also need
to be updated. Currently we have:
To create a subscription, the user must have the privileges of the
pg_create_subscription role, as well as CREATE privileges on the
database.
IIUC if the user uses the SERVER clause, they must have the USAGE
privilege on the foreign server too.
---
We might want to mention in the documentation of CREATE SERVER[2] that
a foreign server's name can be used to connect publication in CREATE
SUBSCRIPTION as we have a similar description for dblink_connect():
When using the dblink module, a foreign server's name can be used as
an argument of the dblink_connect function to indicate the connection
parameters. It is necessary to have the USAGE privilege on the foreign
server to be able to use it in this way.
---
dblink_connect() function can retrieve the connection string from a
foreign server specified in the second argument, which is a very
similar use case to CREATE SUBSCRIPTION. Should we make dblink use the
new function ForeignServerConnectionString() to get the connection
string (in get_connect_string())?
---
It would be better to enhance psql's \dRs command to show the server
name specified in the subscription.
Regards,
[1] https://www.postgresql.org/docs/devel/logical-replication-security.html
[2] https://www.postgresql.org/docs/devel/sql-createserver.html
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com