Re: [19] CREATE SUBSCRIPTION ... SERVER
Jeff Davis <pgsql@j-davis.com>
From: Jeff Davis <pgsql@j-davis.com>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, Masahiko Sawada
<sawada.mshk@gmail.com>, Shlok Kyal <shlok.kyal.oss@gmail.com>, Bharath
Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Joe Conway
<mail@joeconway.com>, pgsql-hackers@postgresql.org
Date: 2026-03-14T22:55:29Z
Lists: pgsql-hackers
Attachments
- v22-0001-Clean-up-postgres_fdw-t-010_subscription.pl.patch (text/x-patch) patch v22-0001
- v22-0002-ALTER-SUBSCRIPTION-.-SERVER-test.patch (text/x-patch) patch v22-0002
- v22-0003-Temp-context-for-maybe_reread_subscription.patch (text/x-patch) patch v22-0003
- v22-0004-Refactor-to-remove-ForeignServerName.patch (text/x-patch) patch v22-0004
- v22-0005-Fix-pg_dump-for-CREATE-FOREIGN-DATA-WRAPPER-.-CO.patch (text/x-patch) patch v22-0005
- v22-0006-Add-pg_dump-tests-related-to-CREATE-SUBSCRIPTION.patch (text/x-patch) patch v22-0006
On Fri, 2026-03-06 at 21:49 +0530, Ashutosh Bapat wrote: > I don't think we need a separate ForeignServerName function. In > AlterSubscription() we already have ForeignSever object which has > server name in it. Other two callers invoke > ForeignServerConnectionString() which in turn fetches ForeignServer > object. Those callers instead may fetch ForeignServer object > themselves and pass it to ForeignServerConnectionString() and use it > in the error message. Done. > The patch has changes to pg_dump.c but there is no corresponding > test. > But I don't think we need a separate test. If the objects created in > regress/*.sql tests are not dropped, 002_pg_upgrade.pl would test > dump/restore of subscriptions with server. It seems that foreign_data.sql expects there to be zero FDWs, servers, and user mappings, so it's not quite that simple. I'm not entirely sure why that is, but I suppose it's meant to be tested in 002_pg_dump.pl instead. I wrote the tests there (attached), which revealed that CREATE FOREIGN DATA WRAPPER ... CONNECTION wasn't being dumped properly. I attached a separate fix for that. Unfortunately I don't think we can rely on regress.so being available when 002_pg_dump.pl runs. Do you have an idea how I can effectively test the FDW (which is needed to test the server and subscription)? I suppose I could make it a built-in function, and that wouldn't be so bad, but not ideal. Right now this test is failing for CI on debian autoconf. > I think we need tests for testing changes in connection when ALTER > SUBSCRIPTION ... SERVER is executed and also those for switching > between SERVER and CONNECTION. Done. Attached series including patches to address Andres's and Amit's comments, too. Thank you! Regards, Jeff Davis
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Document new catalog columns, missed in commit 8185bb5347.
- 90630ec42939 19 (unreleased) landed
-
Refactor to remove ForeignServerName().
- 11f8018ee678 19 (unreleased) landed
-
GetSubscription(): use per-object memory context.
- f16f5d608ca6 19 (unreleased) landed
-
Fix dependency on FDW's connection function.
- 4a0b46b6e1e4 19 (unreleased) landed
-
ALTER SUBSCRIPTION ... SERVER test.
- 1c5bf1185af0 19 (unreleased) landed
-
Fix pg_dump for CREATE FOREIGN DATA WRAPPER ... CONNECTION.
- b71bf3b84570 19 (unreleased) landed
-
Clean up postgres_fdw/t/010_subscription.pl.
- f4af7849b3db 19 (unreleased) landed
-
CREATE SUBSCRIPTION ... SERVER.
- 8185bb534763 19 (unreleased) landed
-
Allow upgrades to preserve the full subscription's state.
- 9a17be1e244a 17.0 cited