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

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Shubham Khanna <khannashubham1197(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Ajin Cherian <itsajin(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-04-09 02:17:54
Message-ID: CAHut+PsmSCQ-ENSDQ0YOUcsgzT=GG-E9jyXBvxd51A_dMXH5XA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I was looking at the recent push for the pg_createsubscription "--all"
option [1], because I was absent for several weeks prior.

I found some minor non-functional issues as follows:

======
doc/src/sgml/ref/pg_createsubscriber.sgml

1.
+ 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.

1a.
There is missing SGML markup in the description of "--all"

- "publisher-server" ==> "the <option>--publisher-server</option>
connection string"
- "postgres database" ==> "<literal>postgres</literal> database"
- "template1 database" ==> "<literal>template1</literal> database"

~

1b.
That sentence "If the database name ..." doesn't give any context
about what it is referring to. I think it needs to be worded more
similarly to the vacuum --maintenance-db option [2] to say it is
connecting to this database in order to "discover" the list of
databases.

SUGGESTION
To discover the list of all databases, connect to the source server
using the database name specified in the
<option>--publisher-server</option> connection string, or if not
specified, the <literal>postgres</literal> database will be used, or
if that does not exist, <literal>template1</literal> will be used.

~

1c.
I didn't think the sentence quite belongs here because it isn't
describing anything about the --all option. Instead, it is describing
how the source server connection is made. So, I felt this might be
better put later in the "Notes/Prerequisites" section where other
source server connection information is described.

======
src/bin/pg_basebackup/pg_createsubscriber.c

get_publisher_databases:

2.
+/*
+ * Fetch a list of all not-template databases from the source server.
+ * Internally, this is treated as if the user specified multiple --database
+ * options, one for each source database.
+ */

/not-template/connectable non-template/

======

Patches are attached to implement the above.

0001. Docs some fixes to the --all description. (see #1a and #1b)
0002. Docs moves part of the --all description to the
Note/Prerequisites section. (see #1c)
0003. Fixes to code comments. (see #2)

======
[1] https://github.com/postgres/postgres/commit/fb2ea12f42b9453853be043b8ed107e136e1ccb7
[2] https://www.postgresql.org/docs/current/app-vacuumdb.html

Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v20250409-0001-DOCS-change-markup-and-wording-for-the-all.patch application/octet-stream 1.5 KB
v20250409-0003-Minor-comment-fix.patch application/octet-stream 1.0 KB
v20250409-0002-DOCS-move-the-description-how-the-all-conn.patch application/octet-stream 2.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Euler Taveira 2025-04-09 02:21:31 Re: Large expressions in indexes can't be stored (non-TOASTable)
Previous Message Richard Guo 2025-04-09 02:05:00 Re: Some problems regarding the self-join elimination code