| From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
|---|---|
| To: | Jeff Davis <pgsql(at)j-davis(dot)com> |
| Cc: | Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: [19] CREATE SUBSCRIPTION ... SERVER |
| Date: | 2026-02-04 04:53:20 |
| Message-ID: | CAD21AoA3dOqh4DeRtLJjzBxYaMfmzxw+s9tMo_wgnV7RdfUvtA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sat, Jan 10, 2026 at 8:55 PM Jeff Davis <pgsql(at)j-davis(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tender Wang | 2026-02-04 04:54:58 | Re: Convert NOT IN sublinks to anti-joins when safe |
| Previous Message | Zhang Mingli | 2026-02-04 04:49:43 | Re: Convert NOT IN sublinks to anti-joins when safe |