pg_createsubscriber: Adding another synopsis for the --all option

Started by Peter Smith9 months ago1 messages
#1Peter Smith
smithpb2250@gmail.com
1 attachment(s)

Hi,

In another thread I had previously suggested adding a 2nd synopsis to
the pg_createsubscriber docs. See [1, comment #5].

------
CURRENT
pg_createsubscriber [option...] { -d | --database }dbname { -D |
--pgdata }datadir { -P | --publisher-server }connstr

SUGGESTION
pg_createsubscriber [option...] {-a | --all} { -D | --pgdata }datadir
{ -P | --publisher-server }connstr
pg_createsubscriber [option...] { -d | --database }dbname { -D |
--pgdata }datadir { -P | --publisher-server }connstr
------

A patch was made for doing this [2, v23-0002] but after some debate it
was omitted from the push for the --all option [3]https://github.com/postgres/postgres/commit/fb2ea12f42b9453853be043b8ed107e136e1ccb7. I was away at the
time so I missed a chance to defend why I felt adding the extra
synopsis may be a good idea. I'll try to do that now:

Nominating which databas(es) the pg_createsubscriber should process is
maybe the most fundamental option of this tool. My reason for the 2nd
synopsis boils down to the fact that "--all" option and "--database"
options are incompatible. E.g there are 2 ways to nominate the
databases: 1) specify them individually or 2) use all of them. It
already describes this in all the option descriptions, but I felt
adding the --all synopsis just makes that point more clear.

Now, vacuumdb was previously cited as a precedent to leave this
unchanged. E.g. vacuumdb doesn't have a separate synopsis for just for
"--all", so pg_createsubscriber doesn't need to either. I think that's
an invalid comparison. The vacuumdb actually does make the distinction
between specifically naming a database and saying --all: e.g. "[
dbname | -a | --all ]". But, it can do that because as far as I know
vacuumdb only accepts a single "--dbname", whereas pg_createsubscriber
allows multiple "--database" options.

This means it would too become complex trying to include --all along
with --database in just one single pg_createsubscriber synopsis. Which
is why, I think 2 separate synopses are warranted.

Thoughts?

(I've reattached the same v23-0002 patch here because it still works)

======
[1]: /messages/by-id/CAHut+PuyBsOJTSygus2-yp60sw_phwYQ-JyC+U6fCBMos9x2LA@mail.gmail.com
[2]: /messages/by-id/CAHv8RjKU24jCHR2fOHocmdSTqhu7ige5UQsUQMkaTZniLc9DbA@mail.gmail.com
[3]: https://github.com/postgres/postgres/commit/fb2ea12f42b9453853be043b8ed107e136e1ccb7

Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v23-0002-Synopsis-for-all-option.patchapplication/octet-stream; name=v23-0002-Synopsis-for-all-option.patchDownload
From 57429906eabf3f58d44b9076c431f6705110f140 Mon Sep 17 00:00:00 2001
From: Khanna <Shubham.Khanna@fujitsu.com>
Date: Fri, 21 Mar 2025 12:29:41 +0530
Subject: [PATCH v23 2/2] Synopsis for --all option

This patch contains the synopsis for the --all option.
---
 doc/src/sgml/ref/pg_createsubscriber.sgml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/doc/src/sgml/ref/pg_createsubscriber.sgml b/doc/src/sgml/ref/pg_createsubscriber.sgml
index 1f0ddd7f9f2..8d8574d7b5f 100644
--- a/doc/src/sgml/ref/pg_createsubscriber.sgml
+++ b/doc/src/sgml/ref/pg_createsubscriber.sgml
@@ -20,6 +20,27 @@ PostgreSQL documentation
  </refnamediv>
 
  <refsynopsisdiv>
+  <cmdsynopsis>
+   <command>pg_createsubscriber</command>
+   <arg rep="repeat"><replaceable>option</replaceable></arg>
+   <group choice="plain">
+    <group choice="req">
+     <arg choice="plain"><option>-a</option></arg>
+     <arg choice="plain"><option>--all</option></arg>
+    </group>
+    <group choice="req">
+     <arg choice="plain"><option>-D</option> </arg>
+     <arg choice="plain"><option>--pgdata</option></arg>
+    </group>
+    <replaceable>datadir</replaceable>
+    <group choice="req">
+     <arg choice="plain"><option>-P</option></arg>
+     <arg choice="plain"><option>--publisher-server</option></arg>
+    </group>
+    <replaceable>connstr</replaceable>
+   </group>
+  </cmdsynopsis>
+
   <cmdsynopsis>
    <command>pg_createsubscriber</command>
    <arg rep="repeat"><replaceable>option</replaceable></arg>
-- 
2.41.0.windows.3