Re: [19] CREATE SUBSCRIPTION ... SERVER

Masahiko Sawada <sawada.mshk@gmail.com>

From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Shlok Kyal <shlok.kyal.oss@gmail.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Joe Conway <mail@joeconway.com>, pgsql-hackers@postgresql.org
Date: 2026-03-03T18:19:54Z
Lists: pgsql-hackers
On Mon, Mar 2, 2026 at 1:34 PM Jeff Davis <pgsql@j-davis.com> wrote:
>
> On Thu, 2026-02-26 at 11:12 -0800, Jeff Davis wrote:
> > On Wed, 2026-02-04 at 13:53 +0900, Masahiko Sawada wrote:
> > > I've reviewed the latest patch set. I understand the motivation
> > > behind
> > > this proposal and find it useful.
> >
> > Thank you, that's important feedback.
>
> Attached v18:
>
>   * rebase
>   * Changed ForeignServerConnectionString() to use a local variable
> rather than a static. It's not very performance-sensitive, so it's OK
> to create a memory context for each invocation, which will be deleted.
> I'm not aware of an actual problem in the previous code, but it seemed
> a bit less safe.
>
> I plan to commit the main patch (v18-0001) soon, after rechecking some
> details (like the postgres_fdw upgrade).

I have a few minor comments:

+   Oid         subserver;      /* Set if connecting with server */
+

Do we want to add BKI_LOOKUP(pg_foreign_data_wrapper) here?

---
+
+# Copyright (c) 2021-2024, PostgreSQL Global Development Group
+

Need to update the copyright year.

The rest looks good to me.

> v18-0002 could use some review
> first.

Thank you for making this patch. I'll look at this patch too.

FYI interestingly, dblink_fdw can also be used for subscription
connections like postgres_fdw. It made me think that it might be
interesting to implement a FDW that supports only the libpq connection
(i.e., NO HANDLER, NO VALIDATOR, and CONNECTION) as it provides the
connection management capability useful for subscriptions while users
can avoid any security risks in postgres_fdw that users might be
concerned about.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Document new catalog columns, missed in commit 8185bb5347.

  2. Refactor to remove ForeignServerName().

  3. GetSubscription(): use per-object memory context.

  4. Fix dependency on FDW's connection function.

  5. ALTER SUBSCRIPTION ... SERVER test.

  6. Fix pg_dump for CREATE FOREIGN DATA WRAPPER ... CONNECTION.

  7. Clean up postgres_fdw/t/010_subscription.pl.

  8. CREATE SUBSCRIPTION ... SERVER.

  9. Allow upgrades to preserve the full subscription's state.