Re: [17] CREATE SUBSCRIPTION ... SERVER
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>,
Joe Conway <mail@joeconway.com>, pgsql-hackers@postgresql.org
Date: 2024-01-05T10:41:59Z
Lists: pgsql-hackers
On Fri, Jan 5, 2024 at 1:34 PM Jeff Davis <pgsql@j-davis.com> wrote:
>
> On Fri, 2024-01-05 at 12:49 +0530, Ashutosh Bapat wrote:
> > Can you please provide an example using postgres_fdw to create a
> > subscription using this patch. I think we should document it in
> > postgres_fdw and add a test for the same.
>
> There's a basic test for postgres_fdw in patch 0003, just testing the
> syntax and validation.
>
> A manual end-to-end test is pretty straightforward:
>
> -- on publisher
> create table foo(i int primary key);
> create publication pub1 for table foo;
> insert into foo values(42);
>
> -- on subscriber
> create extension postgres_fdw;
> create table foo(i int primary key);
> create server server1
> foreign data wrapper postgres_fdw
> options (host '/tmp', port '5432', dbname 'postgres');
> create user mapping for u1 server server1
> options (user 'u1');
> select pg_conninfo_from_server('server1','u1',true);
> create subscription sub1 server server1 publication pub1;
>
> I don't think we need to add an end-to-end test for each FDW, because
> it's just using the assembled connection string. To see if it's
> assembling the connection string properly, we can unit test with
> pg_conninfo_from_server().
Thanks for the steps.
I don't think we need to add a test for every FDW. E.g. adding a test
in file_fdw would be pointless. But postgres_fdw is special. The test
could further create a foreign table ftab_foo on subscriber
referencing foo on publisher and then compare the data from foo and
ftab_foo to make sure that the replication is happening. This will
serve as a good starting point for replicated tables setup in a
sharded cluster.
--
Best Wishes,
Ashutosh Bapat
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