RE: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Shubham Khanna' <khannashubham1197(at)gmail(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Subject: RE: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.
Date: 2025-03-25 09:52:31
Message-ID: OSCPR01MB1496639D5A641A43F20FAFA87F5A72@OSCPR01MB14966.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Shubham,

> The attached patches contain the suggested changes.

Thanks for updating the patch. I reviewed only 0001 because they would be committed separately.
Few comments:

01.
```
+ For every non-template database on the source server, create one
+ subscription on the target server in the database with the same name.
```

It is quite confusing for me; We do not have to describe users that this command
checks databases of the source server. How about something like:
"Create one subscription per all non-template databases on the target server."

02.
```
+# run pg_createsubscriber with '--database' and '--all' without '--dry-run'
+# and verify the failure
+command_fails_like(
+ [
+ 'pg_createsubscriber',
+ '--verbose',
+ '--pgdata' => $node_s->data_dir,
+ '--publisher-server' => $node_p->connstr($db1),
+ '--socketdir' => $node_s->host,
+ '--subscriber-port' => $node_s->port,
+ '--database' => $db1,
+ '--all',
+ ],
+ qr/--database cannot be used with --all/,
+ 'fail if --database is used with --all');
+
+# run pg_createsubscriber with '--publication' and '--all' and verify
+# the failure
+command_fails_like(
+ [
+ 'pg_createsubscriber',
+ '--verbose',
+ '--dry-run',
+ '--pgdata' => $node_s->data_dir,
+ '--publisher-server' => $node_p->connstr($db1),
+ '--socketdir' => $node_s->host,
+ '--subscriber-port' => $node_s->port,
+ '--all',
+ '--publication' => 'pub1',
+ ],
+ qr/--publication cannot be used with --all/,
+ 'fail if --publication is used with --all');
```

You seemed to move most of validation checks to 0002. Can you tell me a reason
why they are remained?

03.
```
+# Verify that the required logical replication objects are created. The
+# expected count 3 refers to postgres, $db1 and $db2 databases.
```

Hmm, but since we did a dry-run, any objects are not created, right?

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-03-25 10:22:45 Re: Support for NO INHERIT to INHERIT state change with named NOT NULL constraints
Previous Message Andrei Lepikhov 2025-03-25 09:42:57 Re: Proposal - Allow extensions to set a Plan Identifier