1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

pg_createsubscriber: Add '--all' option.

The '--all' option indicates that the tool queries the source server
(publisher) for all databases and creates subscriptions on the target
server (subscriber) for databases with matching names. Without this user
needs to explicitly specify all databases by using -d option for each
database.

This simplifies converting a physical standby to a logical subscriber,
particularly during upgrades.

The options '--database', '--publication', '--subscription', and
'--replication-slot' cannot be used when '--all' is specified.

Author: Shubham Khanna <khannashubham1197@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Discussion: https://postgr.es/m/CAHv8RjKhA=_h5vAbozzJ1Opnv=KXYQHQ-fJyaMfqfRqPpnC2bA@mail.gmail.com
This commit is contained in:
Amit Kapila
2025-03-28 12:26:39 +05:30
parent 890fc826c9
commit fb2ea12f42
3 changed files with 187 additions and 11 deletions

View File

@ -87,6 +87,24 @@ PostgreSQL documentation
command-line arguments:
<variablelist>
<varlistentry>
<term><option>-a</option></term>
<term><option>--all</option></term>
<listitem>
<para>
Create one subscription per database on the target server. Exceptions
are template databases and databases that don't allow connections.
If the database name is not specified in publisher-server, the postgres
database will be used, or if that does not exist, template1 will be used.
Automatically generated names for subscriptions, publications, and
replication slots are used when this option is specified.
This option cannot be used along with <option>--database</option>,
<option>--publication</option>, <option>--replication-slot</option>, or
<option>--subscription</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d <replaceable class="parameter">dbname</replaceable></option></term>
<term><option>--database=<replaceable class="parameter">dbname</replaceable></option></term>
@ -94,10 +112,12 @@ PostgreSQL documentation
<para>
The name of the database in which to create a subscription. Multiple
databases can be selected by writing multiple <option>-d</option>
switches. If <option>-d</option> option is not provided, the database
name will be obtained from <option>-P</option> option. If the database
name is not specified in either the <option>-d</option> option or
<option>-P</option> option, an error will be reported.
switches. This option cannot be used together with <option>-a</option>.
If <option>-d</option> option is not provided, the database name will be
obtained from <option>-P</option> option. If the database name is not
specified in either the <option>-d</option> option, or the
<option>-P</option> option, and <option>-a</option> option is not
specified, an error will be reported.
</para>
</listitem>
</varlistentry>
@ -253,7 +273,8 @@ PostgreSQL documentation
names must match the number of specified databases, otherwise an error
is reported. The order of the multiple publication name switches must
match the order of database switches. If this option is not specified,
a generated name is assigned to the publication name.
a generated name is assigned to the publication name. This option cannot
be used together with <option>--all</option>.
</para>
</listitem>
</varlistentry>
@ -269,7 +290,8 @@ PostgreSQL documentation
otherwise an error is reported. The order of the multiple replication
slot name switches must match the order of database switches. If this
option is not specified, the subscription name is assigned to the
replication slot name.
replication slot name. This option cannot be used together with
<option>--all</option>.
</para>
</listitem>
</varlistentry>
@ -284,7 +306,8 @@ PostgreSQL documentation
names must match the number of specified databases, otherwise an error
is reported. The order of the multiple subscription name switches must
match the order of database switches. If this option is not specified,
a generated name is assigned to the subscription name.
a generated name is assigned to the subscription name. This option cannot
be used together with <option>--all</option>.
</para>
</listitem>
</varlistentry>