PGdoc: add missing ID attribute to create_subscription.sgml

Started by Hayato Kuroda (Fujitsu)almost 3 years ago17 messages
#1Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
1 attachment(s)

Dear hackers, (CC: reviewers of copy-binary patch)

This is an follow-up thread of [1]/messages/by-id/CAGPVpCQvAziCLknEnygY0v1-KBtg+Om-9JHJYZOnNPKFJPompw@mail.gmail.com. PSA patch that adds an attributes.

By ecb6965, an XML ID attribute is added only one varlistentry in create_subscription.sgml.
But according to the commit 78ee60 and related discussions [2]/messages/by-id/CAB8KJ=jpuQU9QJe4+RgWENrK5g9jhoysMw2nvTN_esoOU0=a_w@mail.gmail.com, [3]/messages/by-id/3bac458c-b121-1b20-8dea-0665986faa40@gmx.de, it is worth
adding ID attribute to other entries. This patch adds them.

Moreover, I have added some references to parameters from pre-existing documents.
Only entries that are referred from other files have XREFLABEL attribute.

Basically I detected the to-be-added position by:

1. Grepped subscription options, e.g. <literal>two_phase</literal>
2. Found a first place of above detection in each sgml files.
3. Replaced them link, e.g. <xref linkend="sql-createsubscription-with-two-phase"/>.

"XXX = YYY" style was not replaced because there are few links of its style for now.

[1]: /messages/by-id/CAGPVpCQvAziCLknEnygY0v1-KBtg+Om-9JHJYZOnNPKFJPompw@mail.gmail.com
[2]: /messages/by-id/CAB8KJ=jpuQU9QJe4+RgWENrK5g9jhoysMw2nvTN_esoOU0=a_w@mail.gmail.com
[3]: /messages/by-id/3bac458c-b121-1b20-8dea-0665986faa40@gmx.de

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

Attachments:

0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchapplication/octet-stream; name=0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchDownload
From f3c440c34b22d35c03eb36d0f9adec694750d431 Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Wed, 22 Mar 2023 10:14:22 +0000
Subject: [PATCH] Add XML ID attributes to create_subscription.sgml

---
 doc/src/sgml/config.sgml                  |  4 +--
 doc/src/sgml/logical-replication.sgml     | 10 ++++----
 doc/src/sgml/ref/alter_subscription.sgml  | 16 ++++++------
 doc/src/sgml/ref/create_subscription.sgml | 30 +++++++++++------------
 doc/src/sgml/ref/pg_dump.sgml             |  6 ++---
 5 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 481f93cea1..2f9df090e4 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11722,8 +11722,8 @@ LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
         On the publisher side, <varname>logical_replication_mode</varname>
         allows streaming or serializing changes immediately in logical decoding.
         When set to <literal>immediate</literal>, stream each change if the
-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>)
+        <xref linkend="sql-createsubscription-with-streaming"/> option
+        (see optional parameters set by <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>)
         is enabled, otherwise, serialize each change.  When set to
         <literal>buffered</literal>, the decoding will stream or serialize
         changes when <varname>logical_decoding_work_mem</varname> is reached.
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 3836d13ad3..2fba6b93da 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -252,7 +252,7 @@
    additional columns not provided by the published table.  Any such columns
    will be filled with the default value as specified in the definition of the
    target table. However, logical replication in binary format is more
-   restrictive. See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
+   restrictive. See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal>
    option</link> of <command>CREATE SUBSCRIPTION</command> for details.
   </para>
 
@@ -587,7 +587,7 @@ ALTER SUBSCRIPTION
 
    <para>
     Example 2: Where the subscription says <literal>connect = false</literal>,
-    but also specifies the <literal>slot_name</literal>
+    but also specifies the <xref linkend="sql-createsubscription-with-slot-name"/>
     <itemizedlist>
      <listitem>
       <para>
@@ -1500,9 +1500,9 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    <function>pg_replication_origin_advance()</function></link> function.
    Before using this function, the subscription needs to be disabled temporarily
    either by <command>ALTER SUBSCRIPTION ... DISABLE</command> or, the
-   subscription can be used with the <literal>disable_on_error</literal> option.
-   Then, you can use <function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
+   subscription can be used with the <xref linkend="sql-createsubscription-with-disable-on-error"/>
+   option. Then, you can use <function>pg_replication_origin_advance()</function>
+   function with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
    and the next LSN of the finish LSN (i.e., 0/14C0379).  The current position of
    origins can be seen in the <link linkend="view-pg-replication-origin-status">
    <structname>pg_replication_origin_status</structname></link> system view.
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e92346edef..ba6117ab87 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -71,8 +71,8 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
    executed inside a transaction block.
 
    These commands also cannot be executed when the subscription has
-   <literal>two_phase</literal> commit enabled,
-   unless <literal>copy_data</literal> is <literal>false</literal>.
+   <link linkend="sql-createsubscription-with-two-phase"> commit enabled</link>,
+   unless <xref linkend="sql-createsubscription-with-copy-data"/> is <literal>false</literal>.
    See column <structfield>subtwophasestate</structfield> of
    <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
    to know the actual two-phase state.
@@ -175,10 +175,10 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
          <para>
           See <xref linkend="sql-createsubscription-notes"/> for details of
           how <literal>copy_data = true</literal> can interact with the
-          <literal>origin</literal> parameter.
+          <xref linkend="sql-createsubscription-with-origin"/> parameter.
          </para>
          <para>
-          See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
+          See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal>
           option</link> of <command>CREATE SUBSCRIPTION</command> for details
           about copying pre-existing data in binary format.
          </para>
@@ -215,10 +215,10 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
       This clause alters parameters originally set by
       <xref linkend="sql-createsubscription"/>.  See there for more
       information.  The parameters that can be altered
-      are <literal>slot_name</literal>,
-      <literal>synchronous_commit</literal>,
-      <literal>binary</literal>, <literal>streaming</literal>,
-      <literal>disable_on_error</literal>, and
+      are <xref linkend="sql-createsubscription-with-slot-name"/>,
+      <xref linkend="sql-createsubscription-with-synchronous-commit"/>,
+      <literal>binary</literal>, <xref linkend="sql-createsubscription-with-streaming"/>,
+      <xref linkend="sql-createsubscription-with-disable-on-error"/>, and
       <literal>origin</literal>.
      </para>
     </listitem>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 9d4b9d4e33..18d3e9df14 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -61,7 +61,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-name">
     <term><replaceable class="parameter">subscription_name</replaceable></term>
     <listitem>
      <para>
@@ -70,7 +70,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-connection">
     <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
     <listitem>
      <para>
@@ -81,7 +81,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-publication">
     <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]</literal></term>
     <listitem>
      <para>
@@ -90,7 +90,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-with">
     <term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -102,7 +102,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-connect">
         <term><literal>connect</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -129,7 +129,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-create-slot">
         <term><literal>create_slot</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -145,7 +145,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-enabled">
         <term><literal>enabled</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -156,7 +156,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-slot-name" xreflabel="slot_name">
         <term><literal>slot_name</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -185,7 +185,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry id="sql-createsubscription-binary" xreflabel="binary">
+       <varlistentry id="sql-createsubscription-with-binary" xreflabel="binary">
         <term><literal>binary</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-copy-data" xreflabel="copy_data">
         <term><literal>copy_data</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -243,7 +243,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-streaming" xreflabel="streaming">
         <term><literal>streaming</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -271,7 +271,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-synchronous-commit" xreflabel="synchronous_commit">
         <term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -303,7 +303,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-two-phase" xreflabel="two_phase">
         <term><literal>two_phase</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -334,7 +334,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-disable-on-error" xreflabel="disable_on_error">
         <term><literal>disable_on_error</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -346,7 +346,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-origin" xreflabel="origin">
         <term><literal>origin</literal> (<type>string</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index d6b1faa804..bd09547a78 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1458,9 +1458,9 @@ CREATE DATABASE foo WITH TEMPLATE template0;
    truncate the target tables before initiating a new full table copy.  If users
    intend to copy initial data during refresh they must create the slot with
    <literal>two_phase = false</literal>.  After the initial sync, the
-   <literal>two_phase</literal> option will be automatically enabled by the
-   subscriber if the subscription had been originally created with
-   <literal>two_phase = true</literal> option.
+   <xref linkend="sql-createsubscription-with-two-phase"/> option will be
+   automatically enabled by the subscriber if the subscription had been
+   originally created with <literal>two_phase = true</literal> option.
   </para>
  </refsect1>
 
-- 
2.27.0

#2Peter Smith
smithpb2250@gmail.com
In reply to: Hayato Kuroda (Fujitsu) (#1)
Re: PGdoc: add missing ID attribute to create_subscription.sgml

Firstly, +1 for this patch. Directly jumping to the subscription
options makes it much easier to navigate in the documentation instead
of scrolling up and done in CREATE SUBSCRIPTION page looking for each
parameter. Already (just experimenting with this patch) it is
noticeably better.

~~

Anyway, here are my review comments for patch 0001

======
General

1.
It will be better if all the references follow a consistent pattern:

Rule 1 - IMO it is quite important/necessary for these option name
“XXX” (see below) to be rendered using <literal> markup rather than
just plain text font. Unfortunately, I don't know how to do that using
xref labels. If you can figure out some way to do it then great,
otherwise I feel it is better just remove all those xreflabels and
instead create the links like this:

<link linkend="sql-createsubscription-with-XXX"><literal>XXX</literal></link>
option

Rule 2 – Try to keep consistent phrasing like "XXX option" or "XXX
parameter" (whatever is appropriate for the neighbouring text)

~~~

2.
I think you can extend this patch similarly to add IDs for the WITH
parameters of CREATE PUBLICATION. For example, I saw a couple of
places where referencing the 'publish' parameter might be useful.

======
Commit message

3.
Currently, there is nothing.

======
doc/src/sgml/config.sgml

4. (Section 20.17 Developer Options -- logical_replication_mode)

-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)
+        <xref linkend="sql-createsubscription-with-streaming"/> option
+        (see optional parameters set by <link
linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)

Since we now have a direct link to the option, I think the rest of
that sentence can now be a bit simpler. YMMV.

SUGGESTION (per my general comment about links/fonts)
... if the <link
linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
option of <link linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link> is enabled, otherwise, serialize each
change.

======
doc/src/sgml/logical-replication.

5. (Section 31.2 Subscription)

-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)
+        <xref linkend="sql-createsubscription-with-streaming"/> option
+        (see optional parameters set by <link
linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)

For consistency with everything else, I think only the word “binary
should be the link.

SUGGESTION
See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
option ...

~~~

6. (Section 31.2.3 Examples)

- restrictive. See the <link
linkend="sql-createsubscription-binary"><literal>binary</literal>
+ restrictive. See the <link
linkend="sql-createsubscription-with-binary"><literal>binary</literal>

SUGGESTION (per my general comment about links/fonts, and also added
word "option")
<link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>
option.

~~~

7. (Section 31.5 Conflicts)

-   subscription can be used with the
<literal>disable_on_error</literal> option.
-   Then, you can use
<function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e.,
<literal>pg_16395</literal>)
+   subscription can be used with the <xref
linkend="sql-createsubscription-with-disable-on-error"/>
+   option. Then, you can use
<function>pg_replication_origin_advance()</function>
+   function with the <parameter>node_name</parameter> (i.e.,
<literal>pg_16395</literal>)

SUGGESTION (per my general comment about links/fonts)
<link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>

======
doc/src/sgml/ref/alter_subscription.sgml

8. (Description)

-   <literal>two_phase</literal> commit enabled,
-   unless <literal>copy_data</literal> is <literal>false</literal>.
+   <link linkend="sql-createsubscription-with-two-phase"> commit
enabled</link>,
+   unless <xref linkend="sql-createsubscription-with-copy-data"/> is
<literal>false</literal>.

I think the "two_phase" was rendering wrongly because there was a
mixup of link/xref. Suggest fix it like below:

SUGGESTION (per my general comment about links/fonts)
<link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
commit enabled, unless <link
linkend="sql-createsubscription-with-copy-data"><literal>copy_data</literal></link>
is <literal>false</literal>.

~~~

9. (copy_data)

-          <literal>origin</literal> parameter.
+          <xref linkend="sql-createsubscription-with-origin"/> parameter.

SUGGESTION (per my general comment about links/fonts)
<link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>
parameter.

~

10.
<para>
- See the <link
linkend="sql-createsubscription-binary"><literal>binary</literal>
+ See the <link
linkend="sql-createsubscription-with-binary"><literal>binary</literal>

Everything nearby was called a "parameter" so I recommend to change
"binary option" to "binary parameter" here too and move that word
outside the link.

SUGGESTION (per my general comment about links/fonts)
See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
parameter of ...

~~~

11 (SET)

-      are <literal>slot_name</literal>,
-      <literal>synchronous_commit</literal>,
-      <literal>binary</literal>, <literal>streaming</literal>,
-      <literal>disable_on_error</literal>, and
+      are <xref linkend="sql-createsubscription-with-slot-name"/>,
+      <xref linkend="sql-createsubscription-with-synchronous-commit"/>,
+      <literal>binary</literal>, <xref
linkend="sql-createsubscription-with-streaming"/>,
+      <xref linkend="sql-createsubscription-with-disable-on-error"/>, and

Modify so all the fonts are <literal>. Also, the binary link and
origin links were added. I know you said you chose to do that because
they are already linked previously on this page, but in practice, it
looked strange when rendered where only those ones were missing as
links from this long list.

SUGGESTION (per my general comment about links/fonts)
The parameters that can be altered are
<link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>,
<link linkend="sql-createsubscription-with-synchronous-commit"><literal>synchronous_commit</literal></link>,
<link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>,
<link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>,
<link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>,
and
<link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>.

======
doc/src/sgml/ref/create_subscription.sgml

12.
I think all those xreflabels can be removed. As per my general
comment, the references to the WITH option should use a <literal> font
for the option name, but then I was unable to get that working using
xreflabels. So AFAIK those xreflabels are unused (unless they have
some other purpose that I don't know about).

~~~

13.
Sometimes the WITH parameters reference to each other on this page. I
wasn’t sure if we should cross-reference within the same page. What do
you think? It might be useful, or OTOH it might be overkill to have
too many links.

e.g. connect refers to -- create_slot, enabled, copy_data

e.g. a lot_name refers to -- create_slot, enabled

e.g. binary refers to -- copy_data

e.g. copy_data refers to -- origin

e.g. origin refers to -- copy_data

======
doc/src/sgml/ref/pg_dump.sgml

14. (Section II. PG client applications -- pg_dump)

-   <literal>two_phase</literal> option will be automatically enabled by the
-   subscriber if the subscription had been originally created with
-   <literal>two_phase = true</literal> option.
+   <xref linkend="sql-createsubscription-with-two-phase"/> option will be
+   automatically enabled by the subscriber if the subscription had been
+   originally created with <literal>two_phase = true</literal> option.

SUGGESTION (per my general comment about links/fonts)
<link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
option

------
Kind Regards,
Peter Smith.
Fujitsu Australia

#3Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: Peter Smith (#2)
2 attachment(s)
RE: PGdoc: add missing ID attribute to create_subscription.sgml

Dear Peter,

Thank you for reviewing! PSA new patch set.

1.
It will be better if all the references follow a consistent pattern:

Rule 1 - IMO it is quite important/necessary for these option name
“XXX” (see below) to be rendered using <literal> markup rather than
just plain text font. Unfortunately, I don't know how to do that using
xref labels. If you can figure out some way to do it then great,
otherwise I feel it is better just remove all those xreflabels and
instead create the links like this:

<link
linkend="sql-createsubscription-with-XXX"><literal>XXX</literal></link>
option

I have not known the better way, so I followed that.

Rule 2 – Try to keep consistent phrasing like "XXX option" or "XXX
parameter" (whatever is appropriate for the neighbouring text)

Better suggestion.

2.
I think you can extend this patch similarly to add IDs for the WITH
parameters of CREATE PUBLICATION. For example, I saw a couple of
places where referencing the 'publish' parameter might be useful.

This suggestions exceeds initial motivation, but I made a patch. See 0002.

======
Commit message

3.
Currently, there is nothing.

Added.

======
doc/src/sgml/config.sgml

4. (Section 20.17 Developer Options -- logical_replication_mode)

-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)
+        <xref linkend="sql-createsubscription-with-streaming"/> option
+        (see optional parameters set by <link
linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)

Since we now have a direct link to the option, I think the rest of
that sentence can now be a bit simpler. YMMV.

SUGGESTION (per my general comment about links/fonts)
... if the <link
linkend="sql-createsubscription-with-streaming"><literal>streaming</literal>
</link>
option of <link linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link> is enabled, otherwise, serialize each
change.

Changed. Moreover, I reworded from "option" to "parameter" because
It has already been used in the file.

======
doc/src/sgml/logical-replication.

5. (Section 31.2 Subscription)

-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)
+        <xref linkend="sql-createsubscription-with-streaming"/> option
+        (see optional parameters set by <link
linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)

For consistency with everything else, I think only the word “binary
should be the link.

SUGGESTION
See the <link
linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
option ...

You seemed to copy wrong diffs, but your point was right, fixed.

6. (Section 31.2.3 Examples)

- restrictive. See the <link
linkend="sql-createsubscription-binary"><literal>binary</literal>
+ restrictive. See the <link
linkend="sql-createsubscription-with-binary"><literal>binary</literal>

SUGGESTION (per my general comment about links/fonts, and also added
word "option")
<link
linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal>
</link>
option.

You seemed to copy wrong diffs, but I fixed.

7. (Section 31.5 Conflicts)

-   subscription can be used with the
<literal>disable_on_error</literal> option.
-   Then, you can use
<function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e.,
<literal>pg_16395</literal>)
+   subscription can be used with the <xref
linkend="sql-createsubscription-with-disable-on-error"/>
+   option. Then, you can use
<function>pg_replication_origin_advance()</function>
+   function with the <parameter>node_name</parameter> (i.e.,
<literal>pg_16395</literal>)

SUGGESTION (per my general comment about links/fonts)
<link
linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_er
ror</literal></link>

Fixed.

doc/src/sgml/ref/alter_subscription.sgml

8. (Description)

-   <literal>two_phase</literal> commit enabled,
-   unless <literal>copy_data</literal> is <literal>false</literal>.
+   <link linkend="sql-createsubscription-with-two-phase"> commit
enabled</link>,
+   unless <xref linkend="sql-createsubscription-with-copy-data"/> is
<literal>false</literal>.

I think the "two_phase" was rendering wrongly because there was a
mixup of link/xref. Suggest fix it like below:

SUGGESTION (per my general comment about links/fonts)
<link
linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal

</link>

commit enabled, unless <link
linkend="sql-createsubscription-with-copy-data"><literal>copy_data</literal>
</link>
is <literal>false</literal>.

Good detection. Fixed.

9. (copy_data)

-          <literal>origin</literal> parameter.
+          <xref linkend="sql-createsubscription-with-origin"/> parameter.

SUGGESTION (per my general comment about links/fonts)
<link
linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>
parameter.

Fixed.

10.
<para>
- See the <link
linkend="sql-createsubscription-binary"><literal>binary</literal>
+ See the <link
linkend="sql-createsubscription-with-binary"><literal>binary</literal>

Everything nearby was called a "parameter" so I recommend to change
"binary option" to "binary parameter" here too and move that word
outside the link.

SUGGESTION (per my general comment about links/fonts)
See the <link
linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
parameter of ...

Fixed.

11 (SET)

-      are <literal>slot_name</literal>,
-      <literal>synchronous_commit</literal>,
-      <literal>binary</literal>, <literal>streaming</literal>,
-      <literal>disable_on_error</literal>, and
+      are <xref linkend="sql-createsubscription-with-slot-name"/>,
+      <xref linkend="sql-createsubscription-with-synchronous-commit"/>,
+      <literal>binary</literal>, <xref
linkend="sql-createsubscription-with-streaming"/>,
+      <xref linkend="sql-createsubscription-with-disable-on-error"/>, and

Modify so all the fonts are <literal>. Also, the binary link and
origin links were added. I know you said you chose to do that because
they are already linked previously on this page, but in practice, it
looked strange when rendered where only those ones were missing as
links from this long list.

SUGGESTION (per my general comment about links/fonts)
The parameters that can be altered are
<link
linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal>
</link>,
<link
linkend="sql-createsubscription-with-synchronous-commit"><literal>synchron
ous_commit</literal></link>,
<link
linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
,
<link
linkend="sql-createsubscription-with-streaming"><literal>streaming</literal>
</link>,
<link
linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_er
ror</literal></link>,
and
<link
linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>.

Fixed.

doc/src/sgml/ref/create_subscription.sgml

12.
I think all those xreflabels can be removed. As per my general
comment, the references to the WITH option should use a <literal> font
for the option name, but then I was unable to get that working using
xreflabels. So AFAIK those xreflabels are unused (unless they have
some other purpose that I don't know about).

They are no longer used, so removed.

13.
Sometimes the WITH parameters reference to each other on this page. I
wasn’t sure if we should cross-reference within the same page. What do
you think? It might be useful, or OTOH it might be overkill to have
too many links.

e.g. connect refers to -- create_slot, enabled, copy_data

e.g. a lot_name refers to -- create_slot, enabled

e.g. binary refers to -- copy_data

e.g. copy_data refers to -- origin

e.g. origin refers to -- copy_data

I have not added links because it was in the same page and I thought
it was overkill. I checked a few reference pages, e.g. create_table.sgml and
create_type.sgml, but I could not find any links that refer varlistentry
in the same page (except links for <sectN>). So I kept them.

doc/src/sgml/ref/pg_dump.sgml

14. (Section II. PG client applications -- pg_dump)

-   <literal>two_phase</literal> option will be automatically enabled by the
-   subscriber if the subscription had been originally created with
-   <literal>two_phase = true</literal> option.
+   <xref linkend="sql-createsubscription-with-two-phase"/> option will be
+   automatically enabled by the subscriber if the subscription had been
+   originally created with <literal>two_phase = true</literal> option.

SUGGESTION (per my general comment about links/fonts)
<link
linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal

</link>

option

Fixed.

Besides, I have added a missing reference related with "CONNECTION".

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

Attachments:

v2-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchapplication/octet-stream; name=v2-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchDownload
From f1bb1fc7c978036f1de9059185d46c20dcb45896 Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Wed, 22 Mar 2023 10:14:22 +0000
Subject: [PATCH v2 1/2] Add XML ID attributes to create_subscription.sgml

In commit ecb696, an XML ID attribute was added to only one varlistentry,
creating inconsistency with the commit 78ee60. This commit adds XML ID
attributes to all varlistentries in create_subscritpion.sgml for consistency.
Additionally, links are added to refer subscription options, enhancing the
readability of documents.
---
 doc/src/sgml/config.sgml                  |  4 +--
 doc/src/sgml/logical-replication.sgml     | 19 +++++++-------
 doc/src/sgml/ref/alter_subscription.sgml  | 30 ++++++++++++-----------
 doc/src/sgml/ref/create_subscription.sgml | 30 +++++++++++------------
 doc/src/sgml/ref/pg_dump.sgml             |  6 ++---
 5 files changed, 46 insertions(+), 43 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 481f93cea1..eab3429d05 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11722,8 +11722,8 @@ LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
         On the publisher side, <varname>logical_replication_mode</varname>
         allows streaming or serializing changes immediately in logical decoding.
         When set to <literal>immediate</literal>, stream each change if the
-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>)
+        <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+        parameter of <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>
         is enabled, otherwise, serialize each change.  When set to
         <literal>buffered</literal>, the decoding will stream or serialize
         changes when <varname>logical_decoding_work_mem</varname> is reached.
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 3836d13ad3..4aa643ce94 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -252,8 +252,8 @@
    additional columns not provided by the published table.  Any such columns
    will be filled with the default value as specified in the definition of the
    target table. However, logical replication in binary format is more
-   restrictive. See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-   option</link> of <command>CREATE SUBSCRIPTION</command> for details.
+   restrictive. See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+   option of <command>CREATE SUBSCRIPTION</command> for details.
   </para>
 
   <sect2 id="logical-replication-subscription-slot">
@@ -587,7 +587,8 @@ ALTER SUBSCRIPTION
 
    <para>
     Example 2: Where the subscription says <literal>connect = false</literal>,
-    but also specifies the <literal>slot_name</literal>
+    but also specifies the <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>
+    option.
     <itemizedlist>
      <listitem>
       <para>
@@ -704,9 +705,9 @@ ALTER SUBSCRIPTION
     If the row filter evaluates to <literal>false</literal> or <literal>NULL</literal>
     then the row is not replicated. The <literal>WHERE</literal> clause expression
     is evaluated with the same role used for the replication connection (i.e.
-    the role specified in the <literal>CONNECTION</literal> clause of the
-    <xref linkend="sql-createsubscription"/>). Row filters have no effect for
-    <command>TRUNCATE</command> command.
+    the role specified in the <link linkend="sql-createsubscription-connection"><literal>CONNECTION</literal></link>
+    clause of the <xref linkend="sql-createsubscription"/>). Row filters have
+    no effect for <command>TRUNCATE</command> command.
    </para>
 
   </sect2>
@@ -1500,9 +1501,9 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    <function>pg_replication_origin_advance()</function></link> function.
    Before using this function, the subscription needs to be disabled temporarily
    either by <command>ALTER SUBSCRIPTION ... DISABLE</command> or, the
-   subscription can be used with the <literal>disable_on_error</literal> option.
-   Then, you can use <function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
+   subscription can be used with the <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>
+   option. Then, you can use <function>pg_replication_origin_advance()</function>
+   function with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
    and the next LSN of the finish LSN (i.e., 0/14C0379).  The current position of
    origins can be seen in the <link linkend="view-pg-replication-origin-status">
    <structname>pg_replication_origin_status</structname></link> system view.
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e92346edef..0fb35bdfb7 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -71,10 +71,10 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
    executed inside a transaction block.
 
    These commands also cannot be executed when the subscription has
-   <literal>two_phase</literal> commit enabled,
-   unless <literal>copy_data</literal> is <literal>false</literal>.
-   See column <structfield>subtwophasestate</structfield> of
-   <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   commit enabled, unless <link linkend="sql-createsubscription-with-copy-data"><literal>copy_data</literal></link>
+   is <literal>false</literal>. See column <structfield>subtwophasestate</structfield>
+   of <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
    to know the actual two-phase state.
   </para>
  </refsect1>
@@ -175,12 +175,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
          <para>
           See <xref linkend="sql-createsubscription-notes"/> for details of
           how <literal>copy_data = true</literal> can interact with the
-          <literal>origin</literal> parameter.
+          <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>
+          parameter.
          </para>
          <para>
-          See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-          option</link> of <command>CREATE SUBSCRIPTION</command> for details
-          about copying pre-existing data in binary format.
+          See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+          parameter of <command>CREATE SUBSCRIPTION</command> for details about
+          copying pre-existing data in binary format.
          </para>
         </listitem>
        </varlistentry>
@@ -214,12 +215,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
      <para>
       This clause alters parameters originally set by
       <xref linkend="sql-createsubscription"/>.  See there for more
-      information.  The parameters that can be altered
-      are <literal>slot_name</literal>,
-      <literal>synchronous_commit</literal>,
-      <literal>binary</literal>, <literal>streaming</literal>,
-      <literal>disable_on_error</literal>, and
-      <literal>origin</literal>.
+      information.  The parameters that can be altered are
+      <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>,
+      <link linkend="sql-createsubscription-with-synchronous-commit"><literal>synchronous_commit</literal></link>,
+      <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>,
+      <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>,
+      <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>,
+      and <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>.
      </para>
     </listitem>
    </varlistentry>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 9d4b9d4e33..a66b8025f3 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -61,7 +61,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-name">
     <term><replaceable class="parameter">subscription_name</replaceable></term>
     <listitem>
      <para>
@@ -70,7 +70,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-connection">
     <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
     <listitem>
      <para>
@@ -81,7 +81,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-publication">
     <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]</literal></term>
     <listitem>
      <para>
@@ -90,7 +90,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-with">
     <term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -102,7 +102,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-connect">
         <term><literal>connect</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -129,7 +129,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-create-slot">
         <term><literal>create_slot</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -145,7 +145,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-enabled">
         <term><literal>enabled</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -156,7 +156,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-slot-name">
         <term><literal>slot_name</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -185,7 +185,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry id="sql-createsubscription-binary" xreflabel="binary">
+       <varlistentry id="sql-createsubscription-with-binary">
         <term><literal>binary</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-copy-data">
         <term><literal>copy_data</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -243,7 +243,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-streaming">
         <term><literal>streaming</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -271,7 +271,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-synchronous-commit">
         <term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -303,7 +303,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-two-phase">
         <term><literal>two_phase</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -334,7 +334,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-disable-on-error">
         <term><literal>disable_on_error</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -346,7 +346,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-origin">
         <term><literal>origin</literal> (<type>string</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index d6b1faa804..77299878e0 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1458,9 +1458,9 @@ CREATE DATABASE foo WITH TEMPLATE template0;
    truncate the target tables before initiating a new full table copy.  If users
    intend to copy initial data during refresh they must create the slot with
    <literal>two_phase = false</literal>.  After the initial sync, the
-   <literal>two_phase</literal> option will be automatically enabled by the
-   subscriber if the subscription had been originally created with
-   <literal>two_phase = true</literal> option.
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   option will be automatically enabled by the subscriber if the subscription
+   had been originally created with <literal>two_phase = true</literal> option.
   </para>
  </refsect1>
 
-- 
2.27.0

v2-0002-Add-XML-ID-attributes-to-create_publication.sgml.patchapplication/octet-stream; name=v2-0002-Add-XML-ID-attributes-to-create_publication.sgml.patchDownload
From 1f6ec019b5c9c9eebe1ba25043dfc7b4677d07d3 Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Fri, 24 Mar 2023 11:00:53 +0000
Subject: [PATCH v2 2/2] Add XML ID attributes to create_publication.sgml

This commit adds XML ID attributes to all varlistentries in
create_publication.sgml. Additionally, links are included to refer to publication
options, making documents more readable.
---
 doc/src/sgml/logical-replication.sgml     | 27 +++++++++++++----------
 doc/src/sgml/ref/alter_publication.sgml   |  6 ++---
 doc/src/sgml/ref/create_publication.sgml  | 14 ++++++------
 doc/src/sgml/ref/create_subscription.sgml | 23 ++++++++++---------
 doc/src/sgml/system-views.sgml            |  6 ++---
 5 files changed, 40 insertions(+), 36 deletions(-)

diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 4aa643ce94..5f361bf641 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -798,11 +798,12 @@ ALTER SUBSCRIPTION
 
    <para>
     If the publication contains a partitioned table, the publication parameter
-    <literal>publish_via_partition_root</literal> determines which row filter
-    is used. If <literal>publish_via_partition_root</literal> is <literal>true</literal>,
-    the <emphasis>root partitioned table's</emphasis> row filter is used. Otherwise,
-    if <literal>publish_via_partition_root</literal> is <literal>false</literal>
-    (default), each <emphasis>partition's</emphasis> row filter is used.
+    <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+    determines which row filter is used. If <literal>publish_via_partition_root</literal>
+    is <literal>true</literal>, the <emphasis>root partitioned table's</emphasis>
+    row filter is used. Otherwise, if <literal>publish_via_partition_root</literal>
+    is <literal>false</literal> (default), each <emphasis>partition's</emphasis>
+    row filter is used.
    </para>
 
   </sect2>
@@ -826,10 +827,11 @@ ALTER SUBSCRIPTION
    <warning>
     <para>
      Because initial data synchronization does not take into account the
-     <literal>publish</literal> parameter when copying existing table data,
-     some rows may be copied that would not be replicated using DML. Refer to
-     <xref linkend="logical-replication-snapshot"/>, and see
-     <xref linkend="logical-replication-subscription-examples"/> for examples.
+     <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+     parameter when copying existing table data, some rows may be copied that
+     would not be replicated using DML. Refer to <xref linkend="logical-replication-snapshot"/>,
+     and see <xref linkend="logical-replication-subscription-examples"/> for
+     examples.
     </para>
    </warning>
 
@@ -860,15 +862,16 @@ ALTER SUBSCRIPTION
      </listitem>
      <listitem>
       <para>
-       One of the publications was created using <literal>FOR ALL TABLES</literal>.
+       One of the publications was created using <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>.
        This clause does not allow row filters.
       </para>
      </listitem>
      <listitem>
       <para>
        One of the publications was created using
-       <literal>FOR TABLES IN SCHEMA</literal> and the table belongs to
-       the referred schema. This clause does not allow row filters.
+       <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
+       and the table belongs to the referred schema. This clause does not allow
+       row filters.
       </para>
      </listitem>
     </itemizedlist></para>
diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml
index cd20868bca..a37bb734b7 100644
--- a/doc/src/sgml/ref/alter_publication.sgml
+++ b/doc/src/sgml/ref/alter_publication.sgml
@@ -54,7 +54,7 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
    <literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> action on the
    subscribing side in order to become effective. Note also that
    <literal>DROP TABLES IN SCHEMA</literal> will not drop any schema tables
-   that were specified using <literal>FOR TABLE</literal>/
+   that were specified using <link linkend="sql-createpublication-for-table"><literal>FOR TABLE</literal></link>/
    <literal>ADD TABLE</literal>, and the combination of <literal>DROP</literal>
    with a <literal>WHERE</literal> clause is not allowed.
   </para>
@@ -79,8 +79,8 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
    To alter the owner, you must be able to <literal>SET ROLE</literal> to the
    new owning role, and that role must have <literal>CREATE</literal>
    privilege on the database.
-   Also, the new owner of a <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal>
+   Also, the new owner of a <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
    publication must be a superuser. However, a superuser can
    change the ownership of a publication regardless of these restrictions.
   </para>
diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml
index a2946feaa3..1cea8b4563 100644
--- a/doc/src/sgml/ref/create_publication.sgml
+++ b/doc/src/sgml/ref/create_publication.sgml
@@ -54,7 +54,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createpublication-name">
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -63,7 +63,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-table">
     <term><literal>FOR TABLE</literal></term>
     <listitem>
      <para>
@@ -117,7 +117,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-all-tables">
     <term><literal>FOR ALL TABLES</literal></term>
     <listitem>
      <para>
@@ -127,7 +127,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-tables-in-schema">
     <term><literal>FOR TABLES IN SCHEMA</literal></term>
     <listitem>
      <para>
@@ -158,7 +158,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-with">
     <term><literal>WITH ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -166,7 +166,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
       following parameters are supported:
 
       <variablelist>
-       <varlistentry>
+       <varlistentry id="sql-createpublication-with-publish">
         <term><literal>publish</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -188,7 +188,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createpublication-with-publish-via-partition-root">
         <term><literal>publish_via_partition_root</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index a66b8025f3..f4c62c5698 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -418,17 +418,18 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
    the case of different <literal>WHERE</literal> clauses, if one of the
    publications has no <literal>WHERE</literal> clause (referring to that
    publish operation) or the publication is declared as
-   <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal>, rows are always published
-   regardless of the definition of the other expressions.
-   If the subscriber is a <productname>PostgreSQL</productname> version before
-   15, then any row filtering is ignored during the initial data synchronization
-   phase. For this case, the user might want to consider deleting any initially
-   copied data that would be incompatible with subsequent filtering.
-   Because initial data synchronization does not take into account the publication
-   <literal>publish</literal> parameter when copying existing table data, some rows
-   may be copied that would not be replicated using DML. See
-   <xref linkend="logical-replication-subscription-examples"/> for examples.
+   <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
+   rows are always published regardless of the definition of the other
+   expressions. If the subscriber is a <productname>PostgreSQL</productname>
+   version before 15, then any row filtering is ignored during the initial data
+   synchronization phase. For this case, the user might want to consider
+   deleting any initially copied data that would be incompatible with
+   subsequent filtering. Because initial data synchronization does not take
+   into account the publication <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+   parameter when copying existing table data, some rows may be copied that
+   would not be replicated using DML. See <xref linkend="logical-replication-subscription-examples"/>
+   for examples.
   </para>
 
   <para>
diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 7c8fc3f654..a6e50dbadb 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -2145,9 +2145,9 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
    information about the mapping between publications and information of
    tables they contain.  Unlike the underlying catalog
    <link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link>,
-   this view expands publications defined as <literal>FOR ALL TABLES</literal>
-   and <literal>FOR TABLES IN SCHEMA</literal>, so for such publications
-   there will be a row for each eligible table.
+   this view expands publications defined as <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   and <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
+   so for such publications there will be a row for each eligible table.
   </para>
 
   <table>
-- 
2.27.0

#4Peter Smith
smithpb2250@gmail.com
In reply to: Hayato Kuroda (Fujitsu) (#3)
Re: PGdoc: add missing ID attribute to create_subscription.sgml

Here are review comments for v2-0001

======
Commit Message

1.
In commit ecb696, an XML ID attribute was added to only one varlistentry,
creating inconsistency with the commit 78ee60. This commit adds XML ID
attributes to all varlistentries in create_subscritpion.sgml for consistency.
Additionally, links are added to refer subscription options, enhancing the
readability of documents.

~

1a.
Typo: create_subscritpion.sgml

~

1b.
"to refer subscription options" --> "to refer to the subscription options"

======
doc/src/sgml/config.sgml

2.
-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)
+        <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+        parameter of <link
linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>

Now, this link says "streaming parameter", but the very next paragraph
refers to "streaming option". I think it is better to keep them the
same (e.g. both say "streaming option").

======
doc/src/sgml/ref/alter_subscription.sgml

The SKIP part says "... enabling two_phase on subscriber.". I thought
there could be a link for "two_phase" here (also "on subscriber" -->
"on the subscriber").

------
Kind Regards,
Peter Smith.
Fujitsu Australia

#5Peter Smith
smithpb2250@gmail.com
In reply to: Hayato Kuroda (Fujitsu) (#3)
Re: PGdoc: add missing ID attribute to create_subscription.sgml

Here are review comments for v2-0002

======
doc/src/sgml/logical-replication.sgml

1.
I am not sure your convention to only give the link to the FIRST
reference on a page is good in all case. Maybe that rule is OK for
multiple references all in the same sub-section but when they are in
different sub-sections (even on one page) I think it would be better
to include the extra links.

1a.
For example, Section 33.3 (Row Filter) refers to
"publish_via_partition_root" lots of times across multiple subsections
– So it is not convenient to have to scroll around looking in
different sections for the topmost reference which has the link.

1b.
Also in Section 33.3 (Row Filter), there are a couple of places you
could link to "publish" parameter on this page.

~~~

2.
I thought was a missing link in 31.7.1 (Architecture/Initial Snapshot)
which could've linked to the "publish" parameter.

------
Kind Regards,
Peter Smith.
Fujitsu Australia

#6Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: Peter Smith (#4)
RE: PGdoc: add missing ID attribute to create_subscription.sgml

Dear Peter,

Thank you for reviewing! New patch set will be attached in later mail.

======
Commit Message

1.
In commit ecb696, an XML ID attribute was added to only one varlistentry,
creating inconsistency with the commit 78ee60. This commit adds XML ID
attributes to all varlistentries in create_subscritpion.sgml for consistency.
Additionally, links are added to refer subscription options, enhancing the
readability of documents.

~

1a.
Typo: create_subscritpion.sgml

Fixed.

1b.
"to refer subscription options" --> "to refer to the subscription options"

Fixed.

2.
-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>)
+        <link
linkend="sql-createsubscription-with-streaming"><literal>streaming</literal>
</link>
+        parameter of <link
linkend="sql-createsubscription"><command>CREATE
SUBSCRIPTION</command></link>

Now, this link says "streaming parameter", but the very next paragraph
refers to "streaming option". I think it is better to keep them the
same (e.g. both say "streaming option").

I missed just next paragraph, I thought :-(.
Reverted the change, now it is called as "streaming option"

doc/src/sgml/ref/alter_subscription.sgml

The SKIP part says "... enabling two_phase on subscriber.". I thought
there could be a link for "two_phase" here (also "on subscriber" -->
"on the subscriber").

Added.

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

#7Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: Peter Smith (#5)
2 attachment(s)
RE: PGdoc: add missing ID attribute to create_subscription.sgml

Dear Peter,

Thank you for reviewing! PSA new version.

doc/src/sgml/logical-replication.sgml

1.
I am not sure your convention to only give the link to the FIRST
reference on a page is good in all case. Maybe that rule is OK for
multiple references all in the same sub-section but when they are in
different sub-sections (even on one page) I think it would be better
to include the extra links.

Sounds better for readability.

1a.
For example, Section 33.3 (Row Filter) refers to
"publish_via_partition_root" lots of times across multiple subsections
– So it is not convenient to have to scroll around looking in
different sections for the topmost reference which has the link.

Added only two links because almost lines were in the same sub-section(Examples).
Did it match with your expectation?

1b.
Also in Section 33.3 (Row Filter), there are a couple of places you
could link to "publish" parameter on this page.

IIUC there was only one point to add the link, but added.

Also, I have added further links for "FOR ALL TABLES" and "FOR TABLES IN SCHEMA" clauses.

2.
I thought was a missing link in 31.7.1 (Architecture/Initial Snapshot)
which could've linked to the "publish" parameter.

Added.

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

Attachments:

v3-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchapplication/octet-stream; name=v3-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchDownload
From e12d99576dde7d0aeb59f755f1ed51f06008c6a7 Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Wed, 22 Mar 2023 10:14:22 +0000
Subject: [PATCH v3 1/2] Add XML ID attributes to create_subscription.sgml

In commit ecb696, an XML ID attribute was added to only one varlistentry,
creating inconsistency with the commit 78ee60. This commit adds XML ID
attributes to all varlistentries in create_subscription.sgml for consistency.
Additionally, links are added to refer to the subscription options, enhancing
the readability of documents.
---
 doc/src/sgml/config.sgml                  |  4 +--
 doc/src/sgml/logical-replication.sgml     | 19 +++++++------
 doc/src/sgml/ref/alter_subscription.sgml  | 34 ++++++++++++-----------
 doc/src/sgml/ref/create_subscription.sgml | 30 ++++++++++----------
 doc/src/sgml/ref/pg_dump.sgml             |  6 ++--
 5 files changed, 48 insertions(+), 45 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 481f93cea1..a85bba0998 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11722,8 +11722,8 @@ LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
         On the publisher side, <varname>logical_replication_mode</varname>
         allows streaming or serializing changes immediately in logical decoding.
         When set to <literal>immediate</literal>, stream each change if the
-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>)
+        <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+        option of <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>
         is enabled, otherwise, serialize each change.  When set to
         <literal>buffered</literal>, the decoding will stream or serialize
         changes when <varname>logical_decoding_work_mem</varname> is reached.
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 3836d13ad3..4aa643ce94 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -252,8 +252,8 @@
    additional columns not provided by the published table.  Any such columns
    will be filled with the default value as specified in the definition of the
    target table. However, logical replication in binary format is more
-   restrictive. See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-   option</link> of <command>CREATE SUBSCRIPTION</command> for details.
+   restrictive. See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+   option of <command>CREATE SUBSCRIPTION</command> for details.
   </para>
 
   <sect2 id="logical-replication-subscription-slot">
@@ -587,7 +587,8 @@ ALTER SUBSCRIPTION
 
    <para>
     Example 2: Where the subscription says <literal>connect = false</literal>,
-    but also specifies the <literal>slot_name</literal>
+    but also specifies the <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>
+    option.
     <itemizedlist>
      <listitem>
       <para>
@@ -704,9 +705,9 @@ ALTER SUBSCRIPTION
     If the row filter evaluates to <literal>false</literal> or <literal>NULL</literal>
     then the row is not replicated. The <literal>WHERE</literal> clause expression
     is evaluated with the same role used for the replication connection (i.e.
-    the role specified in the <literal>CONNECTION</literal> clause of the
-    <xref linkend="sql-createsubscription"/>). Row filters have no effect for
-    <command>TRUNCATE</command> command.
+    the role specified in the <link linkend="sql-createsubscription-connection"><literal>CONNECTION</literal></link>
+    clause of the <xref linkend="sql-createsubscription"/>). Row filters have
+    no effect for <command>TRUNCATE</command> command.
    </para>
 
   </sect2>
@@ -1500,9 +1501,9 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    <function>pg_replication_origin_advance()</function></link> function.
    Before using this function, the subscription needs to be disabled temporarily
    either by <command>ALTER SUBSCRIPTION ... DISABLE</command> or, the
-   subscription can be used with the <literal>disable_on_error</literal> option.
-   Then, you can use <function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
+   subscription can be used with the <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>
+   option. Then, you can use <function>pg_replication_origin_advance()</function>
+   function with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
    and the next LSN of the finish LSN (i.e., 0/14C0379).  The current position of
    origins can be seen in the <link linkend="view-pg-replication-origin-status">
    <structname>pg_replication_origin_status</structname></link> system view.
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e92346edef..b7e6d2e83a 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -71,10 +71,10 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
    executed inside a transaction block.
 
    These commands also cannot be executed when the subscription has
-   <literal>two_phase</literal> commit enabled,
-   unless <literal>copy_data</literal> is <literal>false</literal>.
-   See column <structfield>subtwophasestate</structfield> of
-   <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   commit enabled, unless <link linkend="sql-createsubscription-with-copy-data"><literal>copy_data</literal></link>
+   is <literal>false</literal>. See column <structfield>subtwophasestate</structfield>
+   of <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
    to know the actual two-phase state.
   </para>
  </refsect1>
@@ -175,12 +175,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
          <para>
           See <xref linkend="sql-createsubscription-notes"/> for details of
           how <literal>copy_data = true</literal> can interact with the
-          <literal>origin</literal> parameter.
+          <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>
+          parameter.
          </para>
          <para>
-          See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-          option</link> of <command>CREATE SUBSCRIPTION</command> for details
-          about copying pre-existing data in binary format.
+          See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+          parameter of <command>CREATE SUBSCRIPTION</command> for details about
+          copying pre-existing data in binary format.
          </para>
         </listitem>
        </varlistentry>
@@ -214,12 +215,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
      <para>
       This clause alters parameters originally set by
       <xref linkend="sql-createsubscription"/>.  See there for more
-      information.  The parameters that can be altered
-      are <literal>slot_name</literal>,
-      <literal>synchronous_commit</literal>,
-      <literal>binary</literal>, <literal>streaming</literal>,
-      <literal>disable_on_error</literal>, and
-      <literal>origin</literal>.
+      information.  The parameters that can be altered are
+      <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>,
+      <link linkend="sql-createsubscription-with-synchronous-commit"><literal>synchronous_commit</literal></link>,
+      <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>,
+      <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>,
+      <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>,
+      and <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>.
      </para>
     </listitem>
    </varlistentry>
@@ -233,8 +235,8 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
       resolved.  By using the <command>ALTER SUBSCRIPTION ... SKIP</command> command,
       the logical replication worker skips all data modification changes within
       the transaction.  This option has no effect on the transactions that are
-      already prepared by enabling <literal>two_phase</literal> on
-      subscriber.
+      already prepared by enabling <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+      on the subscriber.
       After the logical replication worker successfully skips the transaction or
       finishes a transaction, the LSN (stored in
       <structname>pg_subscription</structname>.<structfield>subskiplsn</structfield>)
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 9d4b9d4e33..a66b8025f3 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -61,7 +61,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-name">
     <term><replaceable class="parameter">subscription_name</replaceable></term>
     <listitem>
      <para>
@@ -70,7 +70,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-connection">
     <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
     <listitem>
      <para>
@@ -81,7 +81,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-publication">
     <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]</literal></term>
     <listitem>
      <para>
@@ -90,7 +90,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-with">
     <term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -102,7 +102,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-connect">
         <term><literal>connect</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -129,7 +129,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-create-slot">
         <term><literal>create_slot</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -145,7 +145,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-enabled">
         <term><literal>enabled</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -156,7 +156,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-slot-name">
         <term><literal>slot_name</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -185,7 +185,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry id="sql-createsubscription-binary" xreflabel="binary">
+       <varlistentry id="sql-createsubscription-with-binary">
         <term><literal>binary</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-copy-data">
         <term><literal>copy_data</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -243,7 +243,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-streaming">
         <term><literal>streaming</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -271,7 +271,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-synchronous-commit">
         <term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -303,7 +303,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-two-phase">
         <term><literal>two_phase</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -334,7 +334,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-disable-on-error">
         <term><literal>disable_on_error</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -346,7 +346,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-origin">
         <term><literal>origin</literal> (<type>string</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index d6b1faa804..77299878e0 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1458,9 +1458,9 @@ CREATE DATABASE foo WITH TEMPLATE template0;
    truncate the target tables before initiating a new full table copy.  If users
    intend to copy initial data during refresh they must create the slot with
    <literal>two_phase = false</literal>.  After the initial sync, the
-   <literal>two_phase</literal> option will be automatically enabled by the
-   subscriber if the subscription had been originally created with
-   <literal>two_phase = true</literal> option.
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   option will be automatically enabled by the subscriber if the subscription
+   had been originally created with <literal>two_phase = true</literal> option.
   </para>
  </refsect1>
 
-- 
2.27.0

v3-0002-Add-XML-ID-attributes-to-create_publication.sgml.patchapplication/octet-stream; name=v3-0002-Add-XML-ID-attributes-to-create_publication.sgml.patchDownload
From 5059715816bdcd7552c6ba345fab1f2aa93d756b Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Fri, 24 Mar 2023 11:00:53 +0000
Subject: [PATCH v3 2/2] Add XML ID attributes to create_publication.sgml

This commit adds XML ID attributes to all varlistentries in
create_publication.sgml. Additionally, links are included to refer to publication
options, making documents more readable.
---
 doc/src/sgml/logical-replication.sgml     | 55 ++++++++++++-----------
 doc/src/sgml/ref/alter_publication.sgml   |  6 +--
 doc/src/sgml/ref/create_publication.sgml  | 14 +++---
 doc/src/sgml/ref/create_subscription.sgml | 23 +++++-----
 doc/src/sgml/system-views.sgml            |  6 +--
 5 files changed, 55 insertions(+), 49 deletions(-)

diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 4aa643ce94..2e0774f9d0 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -366,7 +366,7 @@ INSERT 0 3
 
     <para>
      Create publications for the tables. The publications <literal>pub2</literal>
-     and <literal>pub3a</literal> disallow some <literal>publish</literal>
+     and <literal>pub3a</literal> disallow some <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
      operations. The publication <literal>pub3b</literal> has a row filter (see
      <xref linkend="logical-replication-row-filter"/>).
 <programlisting>
@@ -798,11 +798,12 @@ ALTER SUBSCRIPTION
 
    <para>
     If the publication contains a partitioned table, the publication parameter
-    <literal>publish_via_partition_root</literal> determines which row filter
-    is used. If <literal>publish_via_partition_root</literal> is <literal>true</literal>,
-    the <emphasis>root partitioned table's</emphasis> row filter is used. Otherwise,
-    if <literal>publish_via_partition_root</literal> is <literal>false</literal>
-    (default), each <emphasis>partition's</emphasis> row filter is used.
+    <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+    determines which row filter is used. If <literal>publish_via_partition_root</literal>
+    is <literal>true</literal>, the <emphasis>root partitioned table's</emphasis>
+    row filter is used. Otherwise, if <literal>publish_via_partition_root</literal>
+    is <literal>false</literal> (default), each <emphasis>partition's</emphasis>
+    row filter is used.
    </para>
 
   </sect2>
@@ -826,10 +827,11 @@ ALTER SUBSCRIPTION
    <warning>
     <para>
      Because initial data synchronization does not take into account the
-     <literal>publish</literal> parameter when copying existing table data,
-     some rows may be copied that would not be replicated using DML. Refer to
-     <xref linkend="logical-replication-snapshot"/>, and see
-     <xref linkend="logical-replication-subscription-examples"/> for examples.
+     <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+     parameter when copying existing table data, some rows may be copied that
+     would not be replicated using DML. Refer to <xref linkend="logical-replication-snapshot"/>,
+     and see <xref linkend="logical-replication-subscription-examples"/> for
+     examples.
     </para>
    </warning>
 
@@ -848,7 +850,7 @@ ALTER SUBSCRIPTION
 
    <para>
     If the subscription has several publications in which the same table has
-    been published with different row filters (for the same <literal>publish</literal>
+    been published with different row filters (for the same <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
     operation), those expressions get ORed together, so that rows satisfying
     <emphasis>any</emphasis> of the expressions will be replicated. This means all
     the other row filters for the same table become redundant if:
@@ -860,15 +862,16 @@ ALTER SUBSCRIPTION
      </listitem>
      <listitem>
       <para>
-       One of the publications was created using <literal>FOR ALL TABLES</literal>.
+       One of the publications was created using <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>.
        This clause does not allow row filters.
       </para>
      </listitem>
      <listitem>
       <para>
        One of the publications was created using
-       <literal>FOR TABLES IN SCHEMA</literal> and the table belongs to
-       the referred schema. This clause does not allow row filters.
+       <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
+       and the table belongs to the referred schema. This clause does not allow
+       row filters.
       </para>
      </listitem>
     </itemizedlist></para>
@@ -1133,9 +1136,9 @@ test_sub=# SELECT * FROM t1;
 
    <para>
     The following examples show how the publication parameter
-    <literal>publish_via_partition_root</literal> determines whether the row
-    filter of the parent or child table will be used in the case of partitioned
-    tables.
+    <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+    determines whether the row filter of the parent or child table will be used
+    in the case of partitioned tables.
    </para>
 
    <para>
@@ -1288,7 +1291,8 @@ test_sub=# SELECT * FROM child ORDER BY a;
 
   <para>
    Specifying a column list when the publication also publishes
-   <literal>FOR TABLES IN SCHEMA</literal> is not supported.
+   <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
+   is not supported.
   </para>
 
   <para>
@@ -1670,9 +1674,10 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
     </para>
     <note>
      <para>
-      The publication <literal>publish</literal> parameter only affects what
-      DML operations will be replicated. The initial data synchronization does
-      not take this parameter into account when copying the existing table data.
+      The publication <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+      parameter only affects what DML operations will be replicated. The
+      initial data synchronization does not take this parameter into account
+      when copying the existing table data.
      </para>
     </note>
   </sect2>
@@ -1716,10 +1721,10 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    and <literal>TRIGGER</literal> privilege on such tables to trusted roles.
    Moreover, if untrusted users can create tables, use only
    publications that list tables explicitly.  That is to say, create a
-   subscription <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal> only when superusers trust
-   every user permitted to create a non-temp table on the publisher or the
-   subscriber.
+   subscription <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link><literal>FOR TABLES IN SCHEMA</literal>
+   only when superusers trust every user permitted to create a non-temp table
+   on the publisher or the subscriber.
   </para>
 
   <para>
diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml
index cd20868bca..a37bb734b7 100644
--- a/doc/src/sgml/ref/alter_publication.sgml
+++ b/doc/src/sgml/ref/alter_publication.sgml
@@ -54,7 +54,7 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
    <literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> action on the
    subscribing side in order to become effective. Note also that
    <literal>DROP TABLES IN SCHEMA</literal> will not drop any schema tables
-   that were specified using <literal>FOR TABLE</literal>/
+   that were specified using <link linkend="sql-createpublication-for-table"><literal>FOR TABLE</literal></link>/
    <literal>ADD TABLE</literal>, and the combination of <literal>DROP</literal>
    with a <literal>WHERE</literal> clause is not allowed.
   </para>
@@ -79,8 +79,8 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
    To alter the owner, you must be able to <literal>SET ROLE</literal> to the
    new owning role, and that role must have <literal>CREATE</literal>
    privilege on the database.
-   Also, the new owner of a <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal>
+   Also, the new owner of a <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
    publication must be a superuser. However, a superuser can
    change the ownership of a publication regardless of these restrictions.
   </para>
diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml
index a2946feaa3..1cea8b4563 100644
--- a/doc/src/sgml/ref/create_publication.sgml
+++ b/doc/src/sgml/ref/create_publication.sgml
@@ -54,7 +54,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createpublication-name">
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -63,7 +63,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-table">
     <term><literal>FOR TABLE</literal></term>
     <listitem>
      <para>
@@ -117,7 +117,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-all-tables">
     <term><literal>FOR ALL TABLES</literal></term>
     <listitem>
      <para>
@@ -127,7 +127,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-tables-in-schema">
     <term><literal>FOR TABLES IN SCHEMA</literal></term>
     <listitem>
      <para>
@@ -158,7 +158,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-with">
     <term><literal>WITH ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -166,7 +166,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
       following parameters are supported:
 
       <variablelist>
-       <varlistentry>
+       <varlistentry id="sql-createpublication-with-publish">
         <term><literal>publish</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -188,7 +188,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createpublication-with-publish-via-partition-root">
         <term><literal>publish_via_partition_root</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index a66b8025f3..f4c62c5698 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -418,17 +418,18 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
    the case of different <literal>WHERE</literal> clauses, if one of the
    publications has no <literal>WHERE</literal> clause (referring to that
    publish operation) or the publication is declared as
-   <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal>, rows are always published
-   regardless of the definition of the other expressions.
-   If the subscriber is a <productname>PostgreSQL</productname> version before
-   15, then any row filtering is ignored during the initial data synchronization
-   phase. For this case, the user might want to consider deleting any initially
-   copied data that would be incompatible with subsequent filtering.
-   Because initial data synchronization does not take into account the publication
-   <literal>publish</literal> parameter when copying existing table data, some rows
-   may be copied that would not be replicated using DML. See
-   <xref linkend="logical-replication-subscription-examples"/> for examples.
+   <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
+   rows are always published regardless of the definition of the other
+   expressions. If the subscriber is a <productname>PostgreSQL</productname>
+   version before 15, then any row filtering is ignored during the initial data
+   synchronization phase. For this case, the user might want to consider
+   deleting any initially copied data that would be incompatible with
+   subsequent filtering. Because initial data synchronization does not take
+   into account the publication <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+   parameter when copying existing table data, some rows may be copied that
+   would not be replicated using DML. See <xref linkend="logical-replication-subscription-examples"/>
+   for examples.
   </para>
 
   <para>
diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 7c8fc3f654..a6e50dbadb 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -2145,9 +2145,9 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
    information about the mapping between publications and information of
    tables they contain.  Unlike the underlying catalog
    <link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link>,
-   this view expands publications defined as <literal>FOR ALL TABLES</literal>
-   and <literal>FOR TABLES IN SCHEMA</literal>, so for such publications
-   there will be a row for each eligible table.
+   this view expands publications defined as <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   and <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
+   so for such publications there will be a row for each eligible table.
   </para>
 
   <table>
-- 
2.27.0

#8Peter Smith
smithpb2250@gmail.com
In reply to: Hayato Kuroda (Fujitsu) (#7)
Re: PGdoc: add missing ID attribute to create_subscription.sgml

Hi Kuroda-san. Here are my review comments for both patches v3-0001 and v3-0002.

////////
v3-0001
////////

This patch looks good, but I think there are a couple of other places
where you could add links:

~~~

1.1 doc/src/sgml/logical-replication.sgml (31.5 Conflicts)

"When the streaming mode is parallel, the finish LSN ..."

Maybe you can add a "streaming" link there.

~~~

1.2. doc/src/sgml/logical-replication.sgml (31.5 31.8. Monitoring)

"Moreover, if the streaming transaction is applied in parallel, there
may be additional parallel apply workers."

Maybe you can add a "streaming" link there.

////////
v3-0002
////////

There is one bug, and I think there are a couple of other places where
you could add links:

~~~

2.1 doc/src/sgml/logical-replication.sgml (31.4. Column Lists blurb)

For partitioned tables, the publication parameter
publish_via_partition_root determines which column list is used.

~

Maybe you can add a "publish_via_partition_root" link there.

~~~

2.2 doc/src/sgml/logical-replication.sgml (31.6. Restrictions)

Publications can also specify that changes are to be replicated using
the identity and schema of the partitioned root table instead of that
of the individual leaf partitions in which the changes actually
originate (see CREATE PUBLICATION).

~

Maybe that text can be changed now to say something like "(see
publish_via_partition_root parameter of CREATE PUBLICATION)” -- so
only the parameter part has the link, not the CREATE PUBLICATION part.

~~~

2.3 doc/src/sgml/logical-replication.sgml (31.9. Security)

+   subscription <link
linkend="sql-createpublication-for-all-tables"><literal>FOR ALL
TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR
TABLES IN SCHEMA</literal></link><literal>FOR TABLES IN
SCHEMA</literal>
+   only when superusers trust every user permitted to create a non-temp table
+   on the publisher or the subscriber.

There is a cut/paste typo here -- it renders badly with "FOR TABLES IN
SCHEMA" appearing 2x.

------
Kind Regards,
Peter Smith.
Fujitsu Australia

#9Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: Peter Smith (#8)
2 attachment(s)
RE: PGdoc: add missing ID attribute to create_subscription.sgml

Dear Peter,

Thank you for reviewing. PSA new version.

////////
v3-0001
////////

This patch looks good, but I think there are a couple of other places
where you could add links:

~~~

1.1 doc/src/sgml/logical-replication.sgml (31.5 Conflicts)

"When the streaming mode is parallel, the finish LSN ..."

Maybe you can add a "streaming" link there.

Added. It could not be detected because this is not tagged as <literal>.

1.2. doc/src/sgml/logical-replication.sgml (31.5 31.8. Monitoring)

"Moreover, if the streaming transaction is applied in parallel, there
may be additional parallel apply workers."

Maybe you can add a "streaming" link there.

Added.

////////
v3-0002
////////

There is one bug, and I think there are a couple of other places where
you could add links:

~~~

2.1 doc/src/sgml/logical-replication.sgml (31.4. Column Lists blurb)

For partitioned tables, the publication parameter
publish_via_partition_root determines which column list is used.

~

Maybe you can add a "publish_via_partition_root" link there.

Added. I'm not sure why I missed it...

2.2 doc/src/sgml/logical-replication.sgml (31.6. Restrictions)

Publications can also specify that changes are to be replicated using
the identity and schema of the partitioned root table instead of that
of the individual leaf partitions in which the changes actually
originate (see CREATE PUBLICATION).

~

Maybe that text can be changed now to say something like "(see
publish_via_partition_root parameter of CREATE PUBLICATION)” -- so
only the parameter part has the link, not the CREATE PUBLICATION part.

Seems better, added.

2.3 doc/src/sgml/logical-replication.sgml (31.9. Security)

+   subscription <link
linkend="sql-createpublication-for-all-tables"><literal>FOR ALL
TABLES</literal></link>
+   or <link
linkend="sql-createpublication-for-tables-in-schema"><literal>FOR
TABLES IN SCHEMA</literal></link><literal>FOR TABLES IN
SCHEMA</literal>
+   only when superusers trust every user permitted to create a non-temp table
+   on the publisher or the subscriber.

There is a cut/paste typo here -- it renders badly with "FOR TABLES IN
SCHEMA" appearing 2x.

That's my fault, fixed.

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

Attachments:

v4-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchapplication/octet-stream; name=v4-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchDownload
From 1bc444eab033cfa2d5bd3d8545cbc39326702ccb Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Wed, 22 Mar 2023 10:14:22 +0000
Subject: [PATCH v4 1/2] Add XML ID attributes to create_subscription.sgml

In commit ecb696, an XML ID attribute was added to only one varlistentry,
creating inconsistency with the commit 78ee60. This commit adds XML ID
attributes to all varlistentries in create_subscription.sgml for consistency.
Additionally, links are added to refer to the subscription options, enhancing
the readability of documents.
---
 doc/src/sgml/config.sgml                  |  4 +--
 doc/src/sgml/logical-replication.sgml     | 35 ++++++++++++-----------
 doc/src/sgml/ref/alter_subscription.sgml  | 34 +++++++++++-----------
 doc/src/sgml/ref/create_subscription.sgml | 30 +++++++++----------
 doc/src/sgml/ref/pg_dump.sgml             |  6 ++--
 5 files changed, 57 insertions(+), 52 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 71730cc52f..cbcbb10f36 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11742,8 +11742,8 @@ LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
         On the publisher side, <varname>logical_replication_mode</varname>
         allows streaming or serializing changes immediately in logical decoding.
         When set to <literal>immediate</literal>, stream each change if the
-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>)
+        <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+        option of <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>
         is enabled, otherwise, serialize each change.  When set to
         <literal>buffered</literal>, the decoding will stream or serialize
         changes when <varname>logical_decoding_work_mem</varname> is reached.
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 3836d13ad3..1a916d1655 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -252,8 +252,8 @@
    additional columns not provided by the published table.  Any such columns
    will be filled with the default value as specified in the definition of the
    target table. However, logical replication in binary format is more
-   restrictive. See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-   option</link> of <command>CREATE SUBSCRIPTION</command> for details.
+   restrictive. See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+   option of <command>CREATE SUBSCRIPTION</command> for details.
   </para>
 
   <sect2 id="logical-replication-subscription-slot">
@@ -587,7 +587,8 @@ ALTER SUBSCRIPTION
 
    <para>
     Example 2: Where the subscription says <literal>connect = false</literal>,
-    but also specifies the <literal>slot_name</literal>
+    but also specifies the <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>
+    option.
     <itemizedlist>
      <listitem>
       <para>
@@ -704,9 +705,9 @@ ALTER SUBSCRIPTION
     If the row filter evaluates to <literal>false</literal> or <literal>NULL</literal>
     then the row is not replicated. The <literal>WHERE</literal> clause expression
     is evaluated with the same role used for the replication connection (i.e.
-    the role specified in the <literal>CONNECTION</literal> clause of the
-    <xref linkend="sql-createsubscription"/>). Row filters have no effect for
-    <command>TRUNCATE</command> command.
+    the role specified in the <link linkend="sql-createsubscription-connection"><literal>CONNECTION</literal></link>
+    clause of the <xref linkend="sql-createsubscription"/>). Row filters have
+    no effect for <command>TRUNCATE</command> command.
    </para>
 
   </sect2>
@@ -1500,9 +1501,9 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    <function>pg_replication_origin_advance()</function></link> function.
    Before using this function, the subscription needs to be disabled temporarily
    either by <command>ALTER SUBSCRIPTION ... DISABLE</command> or, the
-   subscription can be used with the <literal>disable_on_error</literal> option.
-   Then, you can use <function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
+   subscription can be used with the <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>
+   option. Then, you can use <function>pg_replication_origin_advance()</function>
+   function with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
    and the next LSN of the finish LSN (i.e., 0/14C0379).  The current position of
    origins can be seen in the <link linkend="view-pg-replication-origin-status">
    <structname>pg_replication_origin_status</structname></link> system view.
@@ -1512,11 +1513,12 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
   </para>
 
   <para>
-   When the streaming mode is <literal>parallel</literal>, the finish LSN of
-   failed transactions may not be logged. In that case, it may be necessary to
-   change the streaming mode to <literal>on</literal> or <literal>off</literal> and
-   cause the same conflicts again so the finish LSN of the failed transaction will
-   be written to the server log. For the usage of finish LSN, please refer to <link
+   When the <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+   mode is <literal>parallel</literal>, the finish LSN of failed transactions
+   may not be logged. In that case, it may be necessary to change the streaming
+   mode to <literal>on</literal> or <literal>off</literal> and cause the same
+   conflicts again so the finish LSN of the failed transaction will be written
+   to the server log. For the usage of finish LSN, please refer to <link
    linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION ...
    SKIP</command></link>.
   </para>
@@ -1701,8 +1703,9 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    subscription.  A disabled subscription or a crashed subscription will have
    zero rows in this view.  If the initial data synchronization of any
    table is in progress, there will be additional workers for the tables
-   being synchronized. Moreover, if the streaming transaction is applied in
-   parallel, there may be additional parallel apply workers.
+   being synchronized. Moreover, if the <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+   transaction is applied in parallel, there may be additional parallel apply
+   workers.
   </para>
  </sect1>
 
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e92346edef..b7e6d2e83a 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -71,10 +71,10 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
    executed inside a transaction block.
 
    These commands also cannot be executed when the subscription has
-   <literal>two_phase</literal> commit enabled,
-   unless <literal>copy_data</literal> is <literal>false</literal>.
-   See column <structfield>subtwophasestate</structfield> of
-   <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   commit enabled, unless <link linkend="sql-createsubscription-with-copy-data"><literal>copy_data</literal></link>
+   is <literal>false</literal>. See column <structfield>subtwophasestate</structfield>
+   of <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
    to know the actual two-phase state.
   </para>
  </refsect1>
@@ -175,12 +175,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
          <para>
           See <xref linkend="sql-createsubscription-notes"/> for details of
           how <literal>copy_data = true</literal> can interact with the
-          <literal>origin</literal> parameter.
+          <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>
+          parameter.
          </para>
          <para>
-          See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-          option</link> of <command>CREATE SUBSCRIPTION</command> for details
-          about copying pre-existing data in binary format.
+          See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+          parameter of <command>CREATE SUBSCRIPTION</command> for details about
+          copying pre-existing data in binary format.
          </para>
         </listitem>
        </varlistentry>
@@ -214,12 +215,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
      <para>
       This clause alters parameters originally set by
       <xref linkend="sql-createsubscription"/>.  See there for more
-      information.  The parameters that can be altered
-      are <literal>slot_name</literal>,
-      <literal>synchronous_commit</literal>,
-      <literal>binary</literal>, <literal>streaming</literal>,
-      <literal>disable_on_error</literal>, and
-      <literal>origin</literal>.
+      information.  The parameters that can be altered are
+      <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>,
+      <link linkend="sql-createsubscription-with-synchronous-commit"><literal>synchronous_commit</literal></link>,
+      <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>,
+      <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>,
+      <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>,
+      and <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>.
      </para>
     </listitem>
    </varlistentry>
@@ -233,8 +235,8 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
       resolved.  By using the <command>ALTER SUBSCRIPTION ... SKIP</command> command,
       the logical replication worker skips all data modification changes within
       the transaction.  This option has no effect on the transactions that are
-      already prepared by enabling <literal>two_phase</literal> on
-      subscriber.
+      already prepared by enabling <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+      on the subscriber.
       After the logical replication worker successfully skips the transaction or
       finishes a transaction, the LSN (stored in
       <structname>pg_subscription</structname>.<structfield>subskiplsn</structfield>)
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 9d4b9d4e33..a66b8025f3 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -61,7 +61,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-name">
     <term><replaceable class="parameter">subscription_name</replaceable></term>
     <listitem>
      <para>
@@ -70,7 +70,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-connection">
     <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
     <listitem>
      <para>
@@ -81,7 +81,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-publication">
     <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]</literal></term>
     <listitem>
      <para>
@@ -90,7 +90,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-with">
     <term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -102,7 +102,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-connect">
         <term><literal>connect</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -129,7 +129,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-create-slot">
         <term><literal>create_slot</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -145,7 +145,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-enabled">
         <term><literal>enabled</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -156,7 +156,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-slot-name">
         <term><literal>slot_name</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -185,7 +185,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry id="sql-createsubscription-binary" xreflabel="binary">
+       <varlistentry id="sql-createsubscription-with-binary">
         <term><literal>binary</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-copy-data">
         <term><literal>copy_data</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -243,7 +243,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-streaming">
         <term><literal>streaming</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -271,7 +271,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-synchronous-commit">
         <term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -303,7 +303,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-two-phase">
         <term><literal>two_phase</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -334,7 +334,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-disable-on-error">
         <term><literal>disable_on_error</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -346,7 +346,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-origin">
         <term><literal>origin</literal> (<type>string</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index d6b1faa804..77299878e0 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1458,9 +1458,9 @@ CREATE DATABASE foo WITH TEMPLATE template0;
    truncate the target tables before initiating a new full table copy.  If users
    intend to copy initial data during refresh they must create the slot with
    <literal>two_phase = false</literal>.  After the initial sync, the
-   <literal>two_phase</literal> option will be automatically enabled by the
-   subscriber if the subscription had been originally created with
-   <literal>two_phase = true</literal> option.
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   option will be automatically enabled by the subscriber if the subscription
+   had been originally created with <literal>two_phase = true</literal> option.
   </para>
  </refsect1>
 
-- 
2.27.0

v4-0002-Add-XML-ID-attributes-to-create_publication.sgml.patchapplication/octet-stream; name=v4-0002-Add-XML-ID-attributes-to-create_publication.sgml.patchDownload
From cde515ab5f28222b939ccda31cb32e8422c9eccb Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Fri, 24 Mar 2023 11:00:53 +0000
Subject: [PATCH v4 2/2] Add XML ID attributes to create_publication.sgml

This commit adds XML ID attributes to all varlistentries in
create_publication.sgml. Additionally, links are included to refer to publication
options, making documents more readable.
---
 doc/src/sgml/logical-replication.sgml     | 66 ++++++++++++-----------
 doc/src/sgml/ref/alter_publication.sgml   |  6 +--
 doc/src/sgml/ref/create_publication.sgml  | 14 ++---
 doc/src/sgml/ref/create_subscription.sgml | 23 ++++----
 doc/src/sgml/system-views.sgml            |  6 +--
 5 files changed, 61 insertions(+), 54 deletions(-)

diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 1a916d1655..2cf6218352 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -366,7 +366,7 @@ INSERT 0 3
 
     <para>
      Create publications for the tables. The publications <literal>pub2</literal>
-     and <literal>pub3a</literal> disallow some <literal>publish</literal>
+     and <literal>pub3a</literal> disallow some <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
      operations. The publication <literal>pub3b</literal> has a row filter (see
      <xref linkend="logical-replication-row-filter"/>).
 <programlisting>
@@ -798,11 +798,12 @@ ALTER SUBSCRIPTION
 
    <para>
     If the publication contains a partitioned table, the publication parameter
-    <literal>publish_via_partition_root</literal> determines which row filter
-    is used. If <literal>publish_via_partition_root</literal> is <literal>true</literal>,
-    the <emphasis>root partitioned table's</emphasis> row filter is used. Otherwise,
-    if <literal>publish_via_partition_root</literal> is <literal>false</literal>
-    (default), each <emphasis>partition's</emphasis> row filter is used.
+    <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+    determines which row filter is used. If <literal>publish_via_partition_root</literal>
+    is <literal>true</literal>, the <emphasis>root partitioned table's</emphasis>
+    row filter is used. Otherwise, if <literal>publish_via_partition_root</literal>
+    is <literal>false</literal> (default), each <emphasis>partition's</emphasis>
+    row filter is used.
    </para>
 
   </sect2>
@@ -826,10 +827,11 @@ ALTER SUBSCRIPTION
    <warning>
     <para>
      Because initial data synchronization does not take into account the
-     <literal>publish</literal> parameter when copying existing table data,
-     some rows may be copied that would not be replicated using DML. Refer to
-     <xref linkend="logical-replication-snapshot"/>, and see
-     <xref linkend="logical-replication-subscription-examples"/> for examples.
+     <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+     parameter when copying existing table data, some rows may be copied that
+     would not be replicated using DML. Refer to <xref linkend="logical-replication-snapshot"/>,
+     and see <xref linkend="logical-replication-subscription-examples"/> for
+     examples.
     </para>
    </warning>
 
@@ -848,7 +850,7 @@ ALTER SUBSCRIPTION
 
    <para>
     If the subscription has several publications in which the same table has
-    been published with different row filters (for the same <literal>publish</literal>
+    been published with different row filters (for the same <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
     operation), those expressions get ORed together, so that rows satisfying
     <emphasis>any</emphasis> of the expressions will be replicated. This means all
     the other row filters for the same table become redundant if:
@@ -860,15 +862,16 @@ ALTER SUBSCRIPTION
      </listitem>
      <listitem>
       <para>
-       One of the publications was created using <literal>FOR ALL TABLES</literal>.
+       One of the publications was created using <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>.
        This clause does not allow row filters.
       </para>
      </listitem>
      <listitem>
       <para>
        One of the publications was created using
-       <literal>FOR TABLES IN SCHEMA</literal> and the table belongs to
-       the referred schema. This clause does not allow row filters.
+       <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
+       and the table belongs to the referred schema. This clause does not allow
+       row filters.
       </para>
      </listitem>
     </itemizedlist></para>
@@ -1133,9 +1136,9 @@ test_sub=# SELECT * FROM t1;
 
    <para>
     The following examples show how the publication parameter
-    <literal>publish_via_partition_root</literal> determines whether the row
-    filter of the parent or child table will be used in the case of partitioned
-    tables.
+    <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+    determines whether the row filter of the parent or child table will be used
+    in the case of partitioned tables.
    </para>
 
    <para>
@@ -1288,15 +1291,16 @@ test_sub=# SELECT * FROM child ORDER BY a;
 
   <para>
    Specifying a column list when the publication also publishes
-   <literal>FOR TABLES IN SCHEMA</literal> is not supported.
+   <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
+   is not supported.
   </para>
 
   <para>
    For partitioned tables, the publication parameter
-   <literal>publish_via_partition_root</literal> determines which column list
-   is used. If <literal>publish_via_partition_root</literal> is
-   <literal>true</literal>, the root partitioned table's column list is used.
-   Otherwise, if <literal>publish_via_partition_root</literal> is
+   <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+   determines which column list is used. If <literal>publish_via_partition_root</literal>
+   is <literal>true</literal>, the root partitioned table's column list is
+   used. Otherwise, if <literal>publish_via_partition_root</literal> is
    <literal>false</literal> (the default), each partition's column list is used.
   </para>
 
@@ -1605,7 +1609,8 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
      tables.)  Publications can also specify that changes are to be replicated
      using the identity and schema of the partitioned root table instead of
      that of the individual leaf partitions in which the changes actually
-     originate (see <link linkend="sql-createpublication"><command>CREATE PUBLICATION</command></link>).
+     originate (see <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+     of <command>CREATE PUBLICATION</command>).
     </para>
    </listitem>
   </itemizedlist>
@@ -1671,9 +1676,10 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
     </para>
     <note>
      <para>
-      The publication <literal>publish</literal> parameter only affects what
-      DML operations will be replicated. The initial data synchronization does
-      not take this parameter into account when copying the existing table data.
+      The publication <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+      parameter only affects what DML operations will be replicated. The
+      initial data synchronization does not take this parameter into account
+      when copying the existing table data.
      </para>
     </note>
   </sect2>
@@ -1718,10 +1724,10 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    and <literal>TRIGGER</literal> privilege on such tables to trusted roles.
    Moreover, if untrusted users can create tables, use only
    publications that list tables explicitly.  That is to say, create a
-   subscription <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal> only when superusers trust
-   every user permitted to create a non-temp table on the publisher or the
-   subscriber.
+   subscription <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
+   only when superusers trust every user permitted to create a non-temp table
+   on the publisher or the subscriber.
   </para>
 
   <para>
diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml
index cd20868bca..a37bb734b7 100644
--- a/doc/src/sgml/ref/alter_publication.sgml
+++ b/doc/src/sgml/ref/alter_publication.sgml
@@ -54,7 +54,7 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
    <literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> action on the
    subscribing side in order to become effective. Note also that
    <literal>DROP TABLES IN SCHEMA</literal> will not drop any schema tables
-   that were specified using <literal>FOR TABLE</literal>/
+   that were specified using <link linkend="sql-createpublication-for-table"><literal>FOR TABLE</literal></link>/
    <literal>ADD TABLE</literal>, and the combination of <literal>DROP</literal>
    with a <literal>WHERE</literal> clause is not allowed.
   </para>
@@ -79,8 +79,8 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
    To alter the owner, you must be able to <literal>SET ROLE</literal> to the
    new owning role, and that role must have <literal>CREATE</literal>
    privilege on the database.
-   Also, the new owner of a <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal>
+   Also, the new owner of a <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
    publication must be a superuser. However, a superuser can
    change the ownership of a publication regardless of these restrictions.
   </para>
diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml
index a2946feaa3..1cea8b4563 100644
--- a/doc/src/sgml/ref/create_publication.sgml
+++ b/doc/src/sgml/ref/create_publication.sgml
@@ -54,7 +54,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createpublication-name">
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -63,7 +63,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-table">
     <term><literal>FOR TABLE</literal></term>
     <listitem>
      <para>
@@ -117,7 +117,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-all-tables">
     <term><literal>FOR ALL TABLES</literal></term>
     <listitem>
      <para>
@@ -127,7 +127,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-tables-in-schema">
     <term><literal>FOR TABLES IN SCHEMA</literal></term>
     <listitem>
      <para>
@@ -158,7 +158,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-with">
     <term><literal>WITH ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -166,7 +166,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
       following parameters are supported:
 
       <variablelist>
-       <varlistentry>
+       <varlistentry id="sql-createpublication-with-publish">
         <term><literal>publish</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -188,7 +188,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createpublication-with-publish-via-partition-root">
         <term><literal>publish_via_partition_root</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index a66b8025f3..f4c62c5698 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -418,17 +418,18 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
    the case of different <literal>WHERE</literal> clauses, if one of the
    publications has no <literal>WHERE</literal> clause (referring to that
    publish operation) or the publication is declared as
-   <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal>, rows are always published
-   regardless of the definition of the other expressions.
-   If the subscriber is a <productname>PostgreSQL</productname> version before
-   15, then any row filtering is ignored during the initial data synchronization
-   phase. For this case, the user might want to consider deleting any initially
-   copied data that would be incompatible with subsequent filtering.
-   Because initial data synchronization does not take into account the publication
-   <literal>publish</literal> parameter when copying existing table data, some rows
-   may be copied that would not be replicated using DML. See
-   <xref linkend="logical-replication-subscription-examples"/> for examples.
+   <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
+   rows are always published regardless of the definition of the other
+   expressions. If the subscriber is a <productname>PostgreSQL</productname>
+   version before 15, then any row filtering is ignored during the initial data
+   synchronization phase. For this case, the user might want to consider
+   deleting any initially copied data that would be incompatible with
+   subsequent filtering. Because initial data synchronization does not take
+   into account the publication <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+   parameter when copying existing table data, some rows may be copied that
+   would not be replicated using DML. See <xref linkend="logical-replication-subscription-examples"/>
+   for examples.
   </para>
 
   <para>
diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 7c8fc3f654..a6e50dbadb 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -2145,9 +2145,9 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
    information about the mapping between publications and information of
    tables they contain.  Unlike the underlying catalog
    <link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link>,
-   this view expands publications defined as <literal>FOR ALL TABLES</literal>
-   and <literal>FOR TABLES IN SCHEMA</literal>, so for such publications
-   there will be a row for each eligible table.
+   this view expands publications defined as <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   and <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
+   so for such publications there will be a row for each eligible table.
   </para>
 
   <table>
-- 
2.27.0

#10Peter Smith
smithpb2250@gmail.com
In reply to: Hayato Kuroda (Fujitsu) (#9)
Re: PGdoc: add missing ID attribute to create_subscription.sgml

On Tue, Mar 28, 2023 at 2:04 PM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:

Dear Peter,

Thank you for reviewing. PSA new version.

v4-0001 LGTM

////////
v3-0002
////////

2.2 doc/src/sgml/logical-replication.sgml (31.6. Restrictions)

Publications can also specify that changes are to be replicated using
the identity and schema of the partitioned root table instead of that
of the individual leaf partitions in which the changes actually
originate (see CREATE PUBLICATION).

~

Maybe that text can be changed now to say something like "(see
publish_via_partition_root parameter of CREATE PUBLICATION)” -- so
only the parameter part has the link, not the CREATE PUBLICATION part.

Seems better, added.

-     originate (see <link
linkend="sql-createpublication"><command>CREATE
PUBLICATION</command></link>).
+     originate (see <link
linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+     of <command>CREATE PUBLICATION</command>).

Hmm, my above-suggested wording was “publish_via_partition_root
parameter “ but it seems you (accidentally?) omitted the word
“parameter”.

Otherwise, the patch v4-0002 also LGTM

------
Kind Regards,
Peter Smith.
Fujitsu Australia

#11Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: Peter Smith (#10)
2 attachment(s)
RE: PGdoc: add missing ID attribute to create_subscription.sgml

Dear Peter,

Thank you for prompt reply!

Hmm, my above-suggested wording was “publish_via_partition_root
parameter “ but it seems you (accidentally?) omitted the word
“parameter”.

It is my carelessness, sorry for inconvenience. PSA new ones.

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

Attachments:

v5-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchapplication/octet-stream; name=v5-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchDownload
From 1bc444eab033cfa2d5bd3d8545cbc39326702ccb Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Wed, 22 Mar 2023 10:14:22 +0000
Subject: [PATCH v5 1/2] Add XML ID attributes to create_subscription.sgml

In commit ecb696, an XML ID attribute was added to only one varlistentry,
creating inconsistency with the commit 78ee60. This commit adds XML ID
attributes to all varlistentries in create_subscription.sgml for consistency.
Additionally, links are added to refer to the subscription options, enhancing
the readability of documents.
---
 doc/src/sgml/config.sgml                  |  4 +--
 doc/src/sgml/logical-replication.sgml     | 35 ++++++++++++-----------
 doc/src/sgml/ref/alter_subscription.sgml  | 34 +++++++++++-----------
 doc/src/sgml/ref/create_subscription.sgml | 30 +++++++++----------
 doc/src/sgml/ref/pg_dump.sgml             |  6 ++--
 5 files changed, 57 insertions(+), 52 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 71730cc52f..cbcbb10f36 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11742,8 +11742,8 @@ LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
         On the publisher side, <varname>logical_replication_mode</varname>
         allows streaming or serializing changes immediately in logical decoding.
         When set to <literal>immediate</literal>, stream each change if the
-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>)
+        <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+        option of <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>
         is enabled, otherwise, serialize each change.  When set to
         <literal>buffered</literal>, the decoding will stream or serialize
         changes when <varname>logical_decoding_work_mem</varname> is reached.
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 3836d13ad3..1a916d1655 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -252,8 +252,8 @@
    additional columns not provided by the published table.  Any such columns
    will be filled with the default value as specified in the definition of the
    target table. However, logical replication in binary format is more
-   restrictive. See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-   option</link> of <command>CREATE SUBSCRIPTION</command> for details.
+   restrictive. See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+   option of <command>CREATE SUBSCRIPTION</command> for details.
   </para>
 
   <sect2 id="logical-replication-subscription-slot">
@@ -587,7 +587,8 @@ ALTER SUBSCRIPTION
 
    <para>
     Example 2: Where the subscription says <literal>connect = false</literal>,
-    but also specifies the <literal>slot_name</literal>
+    but also specifies the <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>
+    option.
     <itemizedlist>
      <listitem>
       <para>
@@ -704,9 +705,9 @@ ALTER SUBSCRIPTION
     If the row filter evaluates to <literal>false</literal> or <literal>NULL</literal>
     then the row is not replicated. The <literal>WHERE</literal> clause expression
     is evaluated with the same role used for the replication connection (i.e.
-    the role specified in the <literal>CONNECTION</literal> clause of the
-    <xref linkend="sql-createsubscription"/>). Row filters have no effect for
-    <command>TRUNCATE</command> command.
+    the role specified in the <link linkend="sql-createsubscription-connection"><literal>CONNECTION</literal></link>
+    clause of the <xref linkend="sql-createsubscription"/>). Row filters have
+    no effect for <command>TRUNCATE</command> command.
    </para>
 
   </sect2>
@@ -1500,9 +1501,9 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    <function>pg_replication_origin_advance()</function></link> function.
    Before using this function, the subscription needs to be disabled temporarily
    either by <command>ALTER SUBSCRIPTION ... DISABLE</command> or, the
-   subscription can be used with the <literal>disable_on_error</literal> option.
-   Then, you can use <function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
+   subscription can be used with the <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>
+   option. Then, you can use <function>pg_replication_origin_advance()</function>
+   function with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
    and the next LSN of the finish LSN (i.e., 0/14C0379).  The current position of
    origins can be seen in the <link linkend="view-pg-replication-origin-status">
    <structname>pg_replication_origin_status</structname></link> system view.
@@ -1512,11 +1513,12 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
   </para>
 
   <para>
-   When the streaming mode is <literal>parallel</literal>, the finish LSN of
-   failed transactions may not be logged. In that case, it may be necessary to
-   change the streaming mode to <literal>on</literal> or <literal>off</literal> and
-   cause the same conflicts again so the finish LSN of the failed transaction will
-   be written to the server log. For the usage of finish LSN, please refer to <link
+   When the <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+   mode is <literal>parallel</literal>, the finish LSN of failed transactions
+   may not be logged. In that case, it may be necessary to change the streaming
+   mode to <literal>on</literal> or <literal>off</literal> and cause the same
+   conflicts again so the finish LSN of the failed transaction will be written
+   to the server log. For the usage of finish LSN, please refer to <link
    linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION ...
    SKIP</command></link>.
   </para>
@@ -1701,8 +1703,9 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    subscription.  A disabled subscription or a crashed subscription will have
    zero rows in this view.  If the initial data synchronization of any
    table is in progress, there will be additional workers for the tables
-   being synchronized. Moreover, if the streaming transaction is applied in
-   parallel, there may be additional parallel apply workers.
+   being synchronized. Moreover, if the <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+   transaction is applied in parallel, there may be additional parallel apply
+   workers.
   </para>
  </sect1>
 
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e92346edef..b7e6d2e83a 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -71,10 +71,10 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
    executed inside a transaction block.
 
    These commands also cannot be executed when the subscription has
-   <literal>two_phase</literal> commit enabled,
-   unless <literal>copy_data</literal> is <literal>false</literal>.
-   See column <structfield>subtwophasestate</structfield> of
-   <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   commit enabled, unless <link linkend="sql-createsubscription-with-copy-data"><literal>copy_data</literal></link>
+   is <literal>false</literal>. See column <structfield>subtwophasestate</structfield>
+   of <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
    to know the actual two-phase state.
   </para>
  </refsect1>
@@ -175,12 +175,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
          <para>
           See <xref linkend="sql-createsubscription-notes"/> for details of
           how <literal>copy_data = true</literal> can interact with the
-          <literal>origin</literal> parameter.
+          <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>
+          parameter.
          </para>
          <para>
-          See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-          option</link> of <command>CREATE SUBSCRIPTION</command> for details
-          about copying pre-existing data in binary format.
+          See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+          parameter of <command>CREATE SUBSCRIPTION</command> for details about
+          copying pre-existing data in binary format.
          </para>
         </listitem>
        </varlistentry>
@@ -214,12 +215,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
      <para>
       This clause alters parameters originally set by
       <xref linkend="sql-createsubscription"/>.  See there for more
-      information.  The parameters that can be altered
-      are <literal>slot_name</literal>,
-      <literal>synchronous_commit</literal>,
-      <literal>binary</literal>, <literal>streaming</literal>,
-      <literal>disable_on_error</literal>, and
-      <literal>origin</literal>.
+      information.  The parameters that can be altered are
+      <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>,
+      <link linkend="sql-createsubscription-with-synchronous-commit"><literal>synchronous_commit</literal></link>,
+      <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>,
+      <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>,
+      <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>,
+      and <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>.
      </para>
     </listitem>
    </varlistentry>
@@ -233,8 +235,8 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
       resolved.  By using the <command>ALTER SUBSCRIPTION ... SKIP</command> command,
       the logical replication worker skips all data modification changes within
       the transaction.  This option has no effect on the transactions that are
-      already prepared by enabling <literal>two_phase</literal> on
-      subscriber.
+      already prepared by enabling <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+      on the subscriber.
       After the logical replication worker successfully skips the transaction or
       finishes a transaction, the LSN (stored in
       <structname>pg_subscription</structname>.<structfield>subskiplsn</structfield>)
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 9d4b9d4e33..a66b8025f3 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -61,7 +61,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-name">
     <term><replaceable class="parameter">subscription_name</replaceable></term>
     <listitem>
      <para>
@@ -70,7 +70,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-connection">
     <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
     <listitem>
      <para>
@@ -81,7 +81,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-publication">
     <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]</literal></term>
     <listitem>
      <para>
@@ -90,7 +90,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-with">
     <term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -102,7 +102,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-connect">
         <term><literal>connect</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -129,7 +129,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-create-slot">
         <term><literal>create_slot</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -145,7 +145,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-enabled">
         <term><literal>enabled</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -156,7 +156,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-slot-name">
         <term><literal>slot_name</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -185,7 +185,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry id="sql-createsubscription-binary" xreflabel="binary">
+       <varlistentry id="sql-createsubscription-with-binary">
         <term><literal>binary</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-copy-data">
         <term><literal>copy_data</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -243,7 +243,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-streaming">
         <term><literal>streaming</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -271,7 +271,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-synchronous-commit">
         <term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -303,7 +303,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-two-phase">
         <term><literal>two_phase</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -334,7 +334,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-disable-on-error">
         <term><literal>disable_on_error</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -346,7 +346,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-origin">
         <term><literal>origin</literal> (<type>string</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index d6b1faa804..77299878e0 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1458,9 +1458,9 @@ CREATE DATABASE foo WITH TEMPLATE template0;
    truncate the target tables before initiating a new full table copy.  If users
    intend to copy initial data during refresh they must create the slot with
    <literal>two_phase = false</literal>.  After the initial sync, the
-   <literal>two_phase</literal> option will be automatically enabled by the
-   subscriber if the subscription had been originally created with
-   <literal>two_phase = true</literal> option.
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   option will be automatically enabled by the subscriber if the subscription
+   had been originally created with <literal>two_phase = true</literal> option.
   </para>
  </refsect1>
 
-- 
2.27.0

v5-0002-Add-XML-ID-attributes-to-create_publication.sgml.patchapplication/octet-stream; name=v5-0002-Add-XML-ID-attributes-to-create_publication.sgml.patchDownload
From 83f512bdfcc34ca6c5463b8217e2000c4285b08d Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Fri, 24 Mar 2023 11:00:53 +0000
Subject: [PATCH v5 2/2] Add XML ID attributes to create_publication.sgml

This commit adds XML ID attributes to all varlistentries in
create_publication.sgml. Additionally, links are included to refer to publication
options, making documents more readable.
---
 doc/src/sgml/logical-replication.sgml     | 66 ++++++++++++-----------
 doc/src/sgml/ref/alter_publication.sgml   |  6 +--
 doc/src/sgml/ref/create_publication.sgml  | 14 ++---
 doc/src/sgml/ref/create_subscription.sgml | 23 ++++----
 doc/src/sgml/system-views.sgml            |  6 +--
 5 files changed, 61 insertions(+), 54 deletions(-)

diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 1a916d1655..e4d2560711 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -366,7 +366,7 @@ INSERT 0 3
 
     <para>
      Create publications for the tables. The publications <literal>pub2</literal>
-     and <literal>pub3a</literal> disallow some <literal>publish</literal>
+     and <literal>pub3a</literal> disallow some <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
      operations. The publication <literal>pub3b</literal> has a row filter (see
      <xref linkend="logical-replication-row-filter"/>).
 <programlisting>
@@ -798,11 +798,12 @@ ALTER SUBSCRIPTION
 
    <para>
     If the publication contains a partitioned table, the publication parameter
-    <literal>publish_via_partition_root</literal> determines which row filter
-    is used. If <literal>publish_via_partition_root</literal> is <literal>true</literal>,
-    the <emphasis>root partitioned table's</emphasis> row filter is used. Otherwise,
-    if <literal>publish_via_partition_root</literal> is <literal>false</literal>
-    (default), each <emphasis>partition's</emphasis> row filter is used.
+    <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+    determines which row filter is used. If <literal>publish_via_partition_root</literal>
+    is <literal>true</literal>, the <emphasis>root partitioned table's</emphasis>
+    row filter is used. Otherwise, if <literal>publish_via_partition_root</literal>
+    is <literal>false</literal> (default), each <emphasis>partition's</emphasis>
+    row filter is used.
    </para>
 
   </sect2>
@@ -826,10 +827,11 @@ ALTER SUBSCRIPTION
    <warning>
     <para>
      Because initial data synchronization does not take into account the
-     <literal>publish</literal> parameter when copying existing table data,
-     some rows may be copied that would not be replicated using DML. Refer to
-     <xref linkend="logical-replication-snapshot"/>, and see
-     <xref linkend="logical-replication-subscription-examples"/> for examples.
+     <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+     parameter when copying existing table data, some rows may be copied that
+     would not be replicated using DML. Refer to <xref linkend="logical-replication-snapshot"/>,
+     and see <xref linkend="logical-replication-subscription-examples"/> for
+     examples.
     </para>
    </warning>
 
@@ -848,7 +850,7 @@ ALTER SUBSCRIPTION
 
    <para>
     If the subscription has several publications in which the same table has
-    been published with different row filters (for the same <literal>publish</literal>
+    been published with different row filters (for the same <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
     operation), those expressions get ORed together, so that rows satisfying
     <emphasis>any</emphasis> of the expressions will be replicated. This means all
     the other row filters for the same table become redundant if:
@@ -860,15 +862,16 @@ ALTER SUBSCRIPTION
      </listitem>
      <listitem>
       <para>
-       One of the publications was created using <literal>FOR ALL TABLES</literal>.
+       One of the publications was created using <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>.
        This clause does not allow row filters.
       </para>
      </listitem>
      <listitem>
       <para>
        One of the publications was created using
-       <literal>FOR TABLES IN SCHEMA</literal> and the table belongs to
-       the referred schema. This clause does not allow row filters.
+       <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
+       and the table belongs to the referred schema. This clause does not allow
+       row filters.
       </para>
      </listitem>
     </itemizedlist></para>
@@ -1133,9 +1136,9 @@ test_sub=# SELECT * FROM t1;
 
    <para>
     The following examples show how the publication parameter
-    <literal>publish_via_partition_root</literal> determines whether the row
-    filter of the parent or child table will be used in the case of partitioned
-    tables.
+    <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+    determines whether the row filter of the parent or child table will be used
+    in the case of partitioned tables.
    </para>
 
    <para>
@@ -1288,15 +1291,16 @@ test_sub=# SELECT * FROM child ORDER BY a;
 
   <para>
    Specifying a column list when the publication also publishes
-   <literal>FOR TABLES IN SCHEMA</literal> is not supported.
+   <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
+   is not supported.
   </para>
 
   <para>
    For partitioned tables, the publication parameter
-   <literal>publish_via_partition_root</literal> determines which column list
-   is used. If <literal>publish_via_partition_root</literal> is
-   <literal>true</literal>, the root partitioned table's column list is used.
-   Otherwise, if <literal>publish_via_partition_root</literal> is
+   <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+   determines which column list is used. If <literal>publish_via_partition_root</literal>
+   is <literal>true</literal>, the root partitioned table's column list is
+   used. Otherwise, if <literal>publish_via_partition_root</literal> is
    <literal>false</literal> (the default), each partition's column list is used.
   </para>
 
@@ -1605,7 +1609,8 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
      tables.)  Publications can also specify that changes are to be replicated
      using the identity and schema of the partitioned root table instead of
      that of the individual leaf partitions in which the changes actually
-     originate (see <link linkend="sql-createpublication"><command>CREATE PUBLICATION</command></link>).
+     originate (see <link linkend="sql-createpublication-with-publish-via-partition-root"><literal>publish_via_partition_root</literal></link>
+     parameter of <command>CREATE PUBLICATION</command>).
     </para>
    </listitem>
   </itemizedlist>
@@ -1671,9 +1676,10 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
     </para>
     <note>
      <para>
-      The publication <literal>publish</literal> parameter only affects what
-      DML operations will be replicated. The initial data synchronization does
-      not take this parameter into account when copying the existing table data.
+      The publication <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+      parameter only affects what DML operations will be replicated. The
+      initial data synchronization does not take this parameter into account
+      when copying the existing table data.
      </para>
     </note>
   </sect2>
@@ -1718,10 +1724,10 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    and <literal>TRIGGER</literal> privilege on such tables to trusted roles.
    Moreover, if untrusted users can create tables, use only
    publications that list tables explicitly.  That is to say, create a
-   subscription <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal> only when superusers trust
-   every user permitted to create a non-temp table on the publisher or the
-   subscriber.
+   subscription <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
+   only when superusers trust every user permitted to create a non-temp table
+   on the publisher or the subscriber.
   </para>
 
   <para>
diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml
index cd20868bca..a37bb734b7 100644
--- a/doc/src/sgml/ref/alter_publication.sgml
+++ b/doc/src/sgml/ref/alter_publication.sgml
@@ -54,7 +54,7 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
    <literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> action on the
    subscribing side in order to become effective. Note also that
    <literal>DROP TABLES IN SCHEMA</literal> will not drop any schema tables
-   that were specified using <literal>FOR TABLE</literal>/
+   that were specified using <link linkend="sql-createpublication-for-table"><literal>FOR TABLE</literal></link>/
    <literal>ADD TABLE</literal>, and the combination of <literal>DROP</literal>
    with a <literal>WHERE</literal> clause is not allowed.
   </para>
@@ -79,8 +79,8 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r
    To alter the owner, you must be able to <literal>SET ROLE</literal> to the
    new owning role, and that role must have <literal>CREATE</literal>
    privilege on the database.
-   Also, the new owner of a <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal>
+   Also, the new owner of a <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
    publication must be a superuser. However, a superuser can
    change the ownership of a publication regardless of these restrictions.
   </para>
diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml
index a2946feaa3..1cea8b4563 100644
--- a/doc/src/sgml/ref/create_publication.sgml
+++ b/doc/src/sgml/ref/create_publication.sgml
@@ -54,7 +54,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createpublication-name">
     <term><replaceable class="parameter">name</replaceable></term>
     <listitem>
      <para>
@@ -63,7 +63,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-table">
     <term><literal>FOR TABLE</literal></term>
     <listitem>
      <para>
@@ -117,7 +117,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-all-tables">
     <term><literal>FOR ALL TABLES</literal></term>
     <listitem>
      <para>
@@ -127,7 +127,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-for-tables-in-schema">
     <term><literal>FOR TABLES IN SCHEMA</literal></term>
     <listitem>
      <para>
@@ -158,7 +158,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createpublication-with">
     <term><literal>WITH ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -166,7 +166,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
       following parameters are supported:
 
       <variablelist>
-       <varlistentry>
+       <varlistentry id="sql-createpublication-with-publish">
         <term><literal>publish</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -188,7 +188,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createpublication-with-publish-via-partition-root">
         <term><literal>publish_via_partition_root</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index a66b8025f3..f4c62c5698 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -418,17 +418,18 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
    the case of different <literal>WHERE</literal> clauses, if one of the
    publications has no <literal>WHERE</literal> clause (referring to that
    publish operation) or the publication is declared as
-   <literal>FOR ALL TABLES</literal> or
-   <literal>FOR TABLES IN SCHEMA</literal>, rows are always published
-   regardless of the definition of the other expressions.
-   If the subscriber is a <productname>PostgreSQL</productname> version before
-   15, then any row filtering is ignored during the initial data synchronization
-   phase. For this case, the user might want to consider deleting any initially
-   copied data that would be incompatible with subsequent filtering.
-   Because initial data synchronization does not take into account the publication
-   <literal>publish</literal> parameter when copying existing table data, some rows
-   may be copied that would not be replicated using DML. See
-   <xref linkend="logical-replication-subscription-examples"/> for examples.
+   <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   or <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
+   rows are always published regardless of the definition of the other
+   expressions. If the subscriber is a <productname>PostgreSQL</productname>
+   version before 15, then any row filtering is ignored during the initial data
+   synchronization phase. For this case, the user might want to consider
+   deleting any initially copied data that would be incompatible with
+   subsequent filtering. Because initial data synchronization does not take
+   into account the publication <link linkend="sql-createpublication-with-publish"><literal>publish</literal></link>
+   parameter when copying existing table data, some rows may be copied that
+   would not be replicated using DML. See <xref linkend="logical-replication-subscription-examples"/>
+   for examples.
   </para>
 
   <para>
diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 7c8fc3f654..a6e50dbadb 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -2145,9 +2145,9 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
    information about the mapping between publications and information of
    tables they contain.  Unlike the underlying catalog
    <link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link>,
-   this view expands publications defined as <literal>FOR ALL TABLES</literal>
-   and <literal>FOR TABLES IN SCHEMA</literal>, so for such publications
-   there will be a row for each eligible table.
+   this view expands publications defined as <link linkend="sql-createpublication-for-all-tables"><literal>FOR ALL TABLES</literal></link>
+   and <link linkend="sql-createpublication-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>,
+   so for such publications there will be a row for each eligible table.
   </para>
 
   <table>
-- 
2.27.0

#12Peter Smith
smithpb2250@gmail.com
In reply to: Hayato Kuroda (Fujitsu) (#11)
Re: PGdoc: add missing ID attribute to create_subscription.sgml

Thanks for this patch.

v5-0001 looks good to me.

v5-0002 looks good to me.

I've marked the CF entry [1]https://commitfest.postgresql.org/43/4256/ as "ready for committer".

------
[1]: https://commitfest.postgresql.org/43/4256/

Kind Regards,
Peter Smith.
Fujitsu Australia

#13Amit Kapila
amit.kapila16@gmail.com
In reply to: Hayato Kuroda (Fujitsu) (#11)
Re: PGdoc: add missing ID attribute to create_subscription.sgml

On Tue, Mar 28, 2023 at 9:49 AM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:

Thank you for prompt reply!

Hmm, my above-suggested wording was “publish_via_partition_root
parameter “ but it seems you (accidentally?) omitted the word
“parameter”.

It is my carelessness, sorry for inconvenience. PSA new ones.

In 0001, patch, I see a lot of long lines like below:
-   subscription can be used with the
<literal>disable_on_error</literal> option.
-   Then, you can use
<function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e.,
<literal>pg_16395</literal>)
+   subscription can be used with the <link
linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>

Isn't it better to move the link-related part to the next line
wherever possible? Currently, it looks bit odd.

Why 0002 patch is part of this thread? I thought here we want to add
'ids' to entries corresponding to Create Subscription as we have added
the one in commit ecb696.

--
With Regards,
Amit Kapila.

#14Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: Amit Kapila (#13)
1 attachment(s)
RE: PGdoc: add missing ID attribute to create_subscription.sgml

Dear Amit,

Thank you for reviewing! PSA new version.

Isn't it better to move the link-related part to the next line
wherever possible? Currently, it looks bit odd.

Previously I preferred not to add a new line inside the <link> tag, but it caused
long-line. So I adjusted them not to be too short/long length.

Why 0002 patch is part of this thread? I thought here we want to add
'ids' to entries corresponding to Create Subscription as we have added
the one in commit ecb696.

0002 was motivated by Peter's comment [1]/messages/by-id/CAHut+Pu+-OocYYhW9E0gxxqgfUb1yJ8jVQ4AZ0v-ud00s7TxEA@mail.gmail.com. This exceeds the initial intention of
the patch, so I removed once.

[1]: /messages/by-id/CAHut+Pu+-OocYYhW9E0gxxqgfUb1yJ8jVQ4AZ0v-ud00s7TxEA@mail.gmail.com

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

Attachments:

v6-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchapplication/octet-stream; name=v6-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchDownload
From 6028ae381ad391651aa3eedf8d9e608981a715c0 Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Date: Wed, 22 Mar 2023 10:14:22 +0000
Subject: [PATCH v6] Add XML ID attributes to create_subscription.sgml

In commit ecb696, an XML ID attribute was added to only one varlistentry,
creating inconsistency with the commit 78ee60. This commit adds XML ID
attributes to all varlistentries in create_subscription.sgml for consistency.
Additionally, links are added to refer to the subscription options, enhancing
the readability of documents.
---
 doc/src/sgml/config.sgml                  |  7 ++--
 doc/src/sgml/logical-replication.sgml     | 44 +++++++++++---------
 doc/src/sgml/ref/alter_subscription.sgml  | 49 ++++++++++++-----------
 doc/src/sgml/ref/create_subscription.sgml | 30 +++++++-------
 doc/src/sgml/ref/pg_dump.sgml             |  7 ++--
 5 files changed, 75 insertions(+), 62 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 71730cc52f..a1c36b4353 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11742,9 +11742,10 @@ LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
         On the publisher side, <varname>logical_replication_mode</varname>
         allows streaming or serializing changes immediately in logical decoding.
         When set to <literal>immediate</literal>, stream each change if the
-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>)
-        is enabled, otherwise, serialize each change.  When set to
+        <link linkend="sql-createsubscription-with-streaming">
+        <literal>streaming</literal></link> option of <link
+        linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command>
+        </link> is enabled, otherwise, serialize each change. When set to
         <literal>buffered</literal>, the decoding will stream or serialize
         changes when <varname>logical_decoding_work_mem</varname> is reached.
        </para>
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 3836d13ad3..3540be08e7 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -252,8 +252,9 @@
    additional columns not provided by the published table.  Any such columns
    will be filled with the default value as specified in the definition of the
    target table. However, logical replication in binary format is more
-   restrictive. See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-   option</link> of <command>CREATE SUBSCRIPTION</command> for details.
+   restrictive. See the <link linkend="sql-createsubscription-with-binary">
+   <literal>binary</literal></link> option of <command>CREATE SUBSCRIPTION</command>
+   for details.
   </para>
 
   <sect2 id="logical-replication-subscription-slot">
@@ -587,7 +588,8 @@ ALTER SUBSCRIPTION
 
    <para>
     Example 2: Where the subscription says <literal>connect = false</literal>,
-    but also specifies the <literal>slot_name</literal>
+    but also specifies the <link linkend="sql-createsubscription-with-slot-name">
+    <literal>slot_name</literal></link> option.
     <itemizedlist>
      <listitem>
       <para>
@@ -704,8 +706,9 @@ ALTER SUBSCRIPTION
     If the row filter evaluates to <literal>false</literal> or <literal>NULL</literal>
     then the row is not replicated. The <literal>WHERE</literal> clause expression
     is evaluated with the same role used for the replication connection (i.e.
-    the role specified in the <literal>CONNECTION</literal> clause of the
-    <xref linkend="sql-createsubscription"/>). Row filters have no effect for
+    the role specified in the <link linkend="sql-createsubscription-connection">
+    <literal>CONNECTION</literal></link> clause of the <xref
+    linkend="sql-createsubscription"/>). Row filters have no effect for
     <command>TRUNCATE</command> command.
    </para>
 
@@ -1500,10 +1503,12 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    <function>pg_replication_origin_advance()</function></link> function.
    Before using this function, the subscription needs to be disabled temporarily
    either by <command>ALTER SUBSCRIPTION ... DISABLE</command> or, the
-   subscription can be used with the <literal>disable_on_error</literal> option.
-   Then, you can use <function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
-   and the next LSN of the finish LSN (i.e., 0/14C0379).  The current position of
+   subscription can be used with the <link
+   linkend="sql-createsubscription-with-disable-on-error">
+   <literal>disable_on_error</literal></link> option. Then, you can use
+   <function>pg_replication_origin_advance()</function> function with the
+   <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>) and the
+   next LSN of the finish LSN (i.e., 0/14C0379).  The current position of
    origins can be seen in the <link linkend="view-pg-replication-origin-status">
    <structname>pg_replication_origin_status</structname></link> system view.
    Please note that skipping the whole transaction includes skipping changes that
@@ -1512,13 +1517,14 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
   </para>
 
   <para>
-   When the streaming mode is <literal>parallel</literal>, the finish LSN of
-   failed transactions may not be logged. In that case, it may be necessary to
-   change the streaming mode to <literal>on</literal> or <literal>off</literal> and
-   cause the same conflicts again so the finish LSN of the failed transaction will
-   be written to the server log. For the usage of finish LSN, please refer to <link
-   linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION ...
-   SKIP</command></link>.
+   When the <link linkend="sql-createsubscription-with-streaming">
+   <literal>streaming</literal></link> mode is <literal>parallel</literal>, the
+   finish LSN of failed transactions may not be logged. In that case, it may be
+   necessary to change the streaming mode to <literal>on</literal> or
+   <literal>off</literal> and cause the same conflicts again so the finish LSN
+   of the failed transaction will be written to the server log. For the usage
+   of finish LSN, please refer to <link linkend="sql-altersubscription">
+   <command>ALTER SUBSCRIPTION ... SKIP</command></link>.
   </para>
  </sect1>
 
@@ -1701,8 +1707,10 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    subscription.  A disabled subscription or a crashed subscription will have
    zero rows in this view.  If the initial data synchronization of any
    table is in progress, there will be additional workers for the tables
-   being synchronized. Moreover, if the streaming transaction is applied in
-   parallel, there may be additional parallel apply workers.
+   being synchronized. Moreover, if the <link
+   linkend="sql-createsubscription-with-streaming"><literal>streaming</literal>
+   </link> transaction is applied in parallel, there may be additional parallel
+   apply workers.
   </para>
  </sect1>
 
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e92346edef..a7e1e6bb41 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -71,11 +71,12 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
    executed inside a transaction block.
 
    These commands also cannot be executed when the subscription has
-   <literal>two_phase</literal> commit enabled,
-   unless <literal>copy_data</literal> is <literal>false</literal>.
-   See column <structfield>subtwophasestate</structfield> of
-   <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
-   to know the actual two-phase state.
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal>
+   </link> commit enabled, unless <link linkend="sql-createsubscription-with-copy-data">
+   <literal>copy_data</literal></link> is <literal>false</literal>. See column
+   <structfield>subtwophasestate</structfield> of <link
+   linkend="catalog-pg-subscription"><structname>pg_subscription</structname>
+   </link> to know the actual two-phase state.
   </para>
  </refsect1>
 
@@ -175,12 +176,14 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
          <para>
           See <xref linkend="sql-createsubscription-notes"/> for details of
           how <literal>copy_data = true</literal> can interact with the
-          <literal>origin</literal> parameter.
+          <link linkend="sql-createsubscription-with-origin">
+          <literal>origin</literal></link> parameter.
          </para>
          <para>
-          See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-          option</link> of <command>CREATE SUBSCRIPTION</command> for details
-          about copying pre-existing data in binary format.
+          See the <link linkend="sql-createsubscription-with-binary">
+          <literal>binary</literal></link> parameter of
+          <command>CREATE SUBSCRIPTION</command> for details about copying
+          pre-existing data in binary format.
          </para>
         </listitem>
        </varlistentry>
@@ -214,12 +217,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
      <para>
       This clause alters parameters originally set by
       <xref linkend="sql-createsubscription"/>.  See there for more
-      information.  The parameters that can be altered
-      are <literal>slot_name</literal>,
-      <literal>synchronous_commit</literal>,
-      <literal>binary</literal>, <literal>streaming</literal>,
-      <literal>disable_on_error</literal>, and
-      <literal>origin</literal>.
+      information.  The parameters that can be altered are
+      <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>,
+      <link linkend="sql-createsubscription-with-synchronous-commit"><literal>synchronous_commit</literal></link>,
+      <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>,
+      <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>,
+      <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>,
+      and <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>.
      </para>
     </listitem>
    </varlistentry>
@@ -233,14 +237,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
       resolved.  By using the <command>ALTER SUBSCRIPTION ... SKIP</command> command,
       the logical replication worker skips all data modification changes within
       the transaction.  This option has no effect on the transactions that are
-      already prepared by enabling <literal>two_phase</literal> on
-      subscriber.
-      After the logical replication worker successfully skips the transaction or
-      finishes a transaction, the LSN (stored in
-      <structname>pg_subscription</structname>.<structfield>subskiplsn</structfield>)
-      is cleared.  See <xref linkend="logical-replication-conflicts"/> for
-      the details of logical replication conflicts.  Using this command requires
-      superuser privilege.
+      already prepared by enabling <link linkend="sql-createsubscription-with-two-phase">
+      <literal>two_phase</literal></link> on the subscriber. After the logical
+      replication worker successfully skips the transaction or finishes a
+      transaction, the LSN (stored in <structname>pg_subscription</structname>.
+      <structfield>subskiplsn</structfield>) is cleared.  See <xref
+      linkend="logical-replication-conflicts"/> for the details of logical
+      replication conflicts. Using this command requires superuser privilege.
      </para>
 
      <para>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 9d4b9d4e33..a66b8025f3 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -61,7 +61,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-name">
     <term><replaceable class="parameter">subscription_name</replaceable></term>
     <listitem>
      <para>
@@ -70,7 +70,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-connection">
     <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
     <listitem>
      <para>
@@ -81,7 +81,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-publication">
     <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]</literal></term>
     <listitem>
      <para>
@@ -90,7 +90,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-with">
     <term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -102,7 +102,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-connect">
         <term><literal>connect</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -129,7 +129,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-create-slot">
         <term><literal>create_slot</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -145,7 +145,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-enabled">
         <term><literal>enabled</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -156,7 +156,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-slot-name">
         <term><literal>slot_name</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -185,7 +185,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry id="sql-createsubscription-binary" xreflabel="binary">
+       <varlistentry id="sql-createsubscription-with-binary">
         <term><literal>binary</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-copy-data">
         <term><literal>copy_data</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -243,7 +243,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-streaming">
         <term><literal>streaming</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -271,7 +271,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-synchronous-commit">
         <term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -303,7 +303,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-two-phase">
         <term><literal>two_phase</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -334,7 +334,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-disable-on-error">
         <term><literal>disable_on_error</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -346,7 +346,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-origin">
         <term><literal>origin</literal> (<type>string</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index d6b1faa804..679fa727cd 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1458,9 +1458,10 @@ CREATE DATABASE foo WITH TEMPLATE template0;
    truncate the target tables before initiating a new full table copy.  If users
    intend to copy initial data during refresh they must create the slot with
    <literal>two_phase = false</literal>.  After the initial sync, the
-   <literal>two_phase</literal> option will be automatically enabled by the
-   subscriber if the subscription had been originally created with
-   <literal>two_phase = true</literal> option.
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal>
+   </link> option will be automatically enabled by the subscriber if the
+   subscription had been originally created with <literal>two_phase = true</literal>
+   option.
   </para>
  </refsect1>
 
-- 
2.27.0

#15Amit Kapila
amit.kapila16@gmail.com
In reply to: Hayato Kuroda (Fujitsu) (#14)
1 attachment(s)
Re: PGdoc: add missing ID attribute to create_subscription.sgml

On Tue, Mar 28, 2023 at 1:00 PM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:

Dear Amit,

Thank you for reviewing! PSA new version.

Isn't it better to move the link-related part to the next line
wherever possible? Currently, it looks bit odd.

Previously I preferred not to add a new line inside the <link> tag, but it caused
long-line. So I adjusted them not to be too short/long length.

There is no need to break the link line. See attached.

--
With Regards,
Amit Kapila.

Attachments:

v7-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchapplication/octet-stream; name=v7-0001-Add-XML-ID-attributes-to-create_subscription.sgml.patchDownload
From e9ca13227ebbb09d494fb8fa9aad6e4596fae830 Mon Sep 17 00:00:00 2001
From: Amit Kapila <akapila@postgresql.org>
Date: Tue, 28 Mar 2023 17:12:22 +0530
Subject: [PATCH v7] Add XML ID attributes to create_subscription.sgml.

Commit ecb696527c added an XML ID attribute to one varlistentry in
create_subscription.sgml. Following 78ee60ed84, this commit adds XML ID
attributes to all varlistentries in create_subscription.sgml.
Additionally, links are added to refer to the subscription options,
enhancing the readability of documents.

Author: Kuroda Hayato
Reviewed-by: Peter Smith, Amit Kapila
Discussion: https://postgr.es/m/TYAPR01MB58667AE04D291924671E2051F5879@TYAPR01MB5866.jpnprd01.prod.outlook.com
---
 doc/src/sgml/config.sgml                  |  5 +--
 doc/src/sgml/logical-replication.sgml     | 41 ++++++++++++++---------
 doc/src/sgml/ref/alter_subscription.sgml  | 37 +++++++++++---------
 doc/src/sgml/ref/create_subscription.sgml | 30 ++++++++---------
 doc/src/sgml/ref/pg_dump.sgml             |  6 ++--
 5 files changed, 67 insertions(+), 52 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 71730cc52f..f5364daef2 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11742,8 +11742,9 @@ LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
         On the publisher side, <varname>logical_replication_mode</varname>
         allows streaming or serializing changes immediately in logical decoding.
         When set to <literal>immediate</literal>, stream each change if the
-        <literal>streaming</literal> option (see optional parameters set by
-        <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>)
+        <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+        option of
+        <link linkend="sql-createsubscription"><command>CREATE SUBSCRIPTION</command></link>
         is enabled, otherwise, serialize each change.  When set to
         <literal>buffered</literal>, the decoding will stream or serialize
         changes when <varname>logical_decoding_work_mem</varname> is reached.
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 3836d13ad3..6358c5da05 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -252,8 +252,9 @@
    additional columns not provided by the published table.  Any such columns
    will be filled with the default value as specified in the definition of the
    target table. However, logical replication in binary format is more
-   restrictive. See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-   option</link> of <command>CREATE SUBSCRIPTION</command> for details.
+   restrictive. See the
+   <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+   option of <command>CREATE SUBSCRIPTION</command> for details.
   </para>
 
   <sect2 id="logical-replication-subscription-slot">
@@ -587,7 +588,9 @@ ALTER SUBSCRIPTION
 
    <para>
     Example 2: Where the subscription says <literal>connect = false</literal>,
-    but also specifies the <literal>slot_name</literal>
+    but also specifies the
+    <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>
+    option.
     <itemizedlist>
      <listitem>
       <para>
@@ -704,9 +707,10 @@ ALTER SUBSCRIPTION
     If the row filter evaluates to <literal>false</literal> or <literal>NULL</literal>
     then the row is not replicated. The <literal>WHERE</literal> clause expression
     is evaluated with the same role used for the replication connection (i.e.
-    the role specified in the <literal>CONNECTION</literal> clause of the
-    <xref linkend="sql-createsubscription"/>). Row filters have no effect for
-    <command>TRUNCATE</command> command.
+    the role specified in the
+    <link linkend="sql-createsubscription-connection"><literal>CONNECTION</literal></link>
+    clause of the <xref linkend="sql-createsubscription"/>). Row filters have
+    no effect for <command>TRUNCATE</command> command.
    </para>
 
   </sect2>
@@ -1500,9 +1504,10 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    <function>pg_replication_origin_advance()</function></link> function.
    Before using this function, the subscription needs to be disabled temporarily
    either by <command>ALTER SUBSCRIPTION ... DISABLE</command> or, the
-   subscription can be used with the <literal>disable_on_error</literal> option.
-   Then, you can use <function>pg_replication_origin_advance()</function> function
-   with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
+   subscription can be used with the
+   <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>
+   option. Then, you can use <function>pg_replication_origin_advance()</function>
+   function with the <parameter>node_name</parameter> (i.e., <literal>pg_16395</literal>)
    and the next LSN of the finish LSN (i.e., 0/14C0379).  The current position of
    origins can be seen in the <link linkend="view-pg-replication-origin-status">
    <structname>pg_replication_origin_status</structname></link> system view.
@@ -1512,11 +1517,13 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
   </para>
 
   <para>
-   When the streaming mode is <literal>parallel</literal>, the finish LSN of
-   failed transactions may not be logged. In that case, it may be necessary to
-   change the streaming mode to <literal>on</literal> or <literal>off</literal> and
-   cause the same conflicts again so the finish LSN of the failed transaction will
-   be written to the server log. For the usage of finish LSN, please refer to <link
+   When the
+   <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+   mode is <literal>parallel</literal>, the finish LSN of failed transactions
+   may not be logged. In that case, it may be necessary to change the streaming
+   mode to <literal>on</literal> or <literal>off</literal> and cause the same
+   conflicts again so the finish LSN of the failed transaction will be written
+   to the server log. For the usage of finish LSN, please refer to <link
    linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION ...
    SKIP</command></link>.
   </para>
@@ -1701,8 +1708,10 @@ CONTEXT:  processing remote data for replication origin "pg_16395" during "INSER
    subscription.  A disabled subscription or a crashed subscription will have
    zero rows in this view.  If the initial data synchronization of any
    table is in progress, there will be additional workers for the tables
-   being synchronized. Moreover, if the streaming transaction is applied in
-   parallel, there may be additional parallel apply workers.
+   being synchronized. Moreover, if the
+   <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
+   transaction is applied in parallel, there may be additional parallel apply
+   workers.
   </para>
  </sect1>
 
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e92346edef..9735a82206 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -71,10 +71,11 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
    executed inside a transaction block.
 
    These commands also cannot be executed when the subscription has
-   <literal>two_phase</literal> commit enabled,
-   unless <literal>copy_data</literal> is <literal>false</literal>.
-   See column <structfield>subtwophasestate</structfield> of
-   <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   commit enabled, unless
+   <link linkend="sql-createsubscription-with-copy-data"><literal>copy_data</literal></link>
+   is <literal>false</literal>. See column <structfield>subtwophasestate</structfield>
+   of <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
    to know the actual two-phase state.
   </para>
  </refsect1>
@@ -175,12 +176,14 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
          <para>
           See <xref linkend="sql-createsubscription-notes"/> for details of
           how <literal>copy_data = true</literal> can interact with the
-          <literal>origin</literal> parameter.
+          <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>
+          parameter.
          </para>
          <para>
-          See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
-          option</link> of <command>CREATE SUBSCRIPTION</command> for details
-          about copying pre-existing data in binary format.
+          See the
+          <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>
+          parameter of <command>CREATE SUBSCRIPTION</command> for details about
+          copying pre-existing data in binary format.
          </para>
         </listitem>
        </varlistentry>
@@ -214,12 +217,13 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
      <para>
       This clause alters parameters originally set by
       <xref linkend="sql-createsubscription"/>.  See there for more
-      information.  The parameters that can be altered
-      are <literal>slot_name</literal>,
-      <literal>synchronous_commit</literal>,
-      <literal>binary</literal>, <literal>streaming</literal>,
-      <literal>disable_on_error</literal>, and
-      <literal>origin</literal>.
+      information.  The parameters that can be altered are
+      <link linkend="sql-createsubscription-with-slot-name"><literal>slot_name</literal></link>,
+      <link linkend="sql-createsubscription-with-synchronous-commit"><literal>synchronous_commit</literal></link>,
+      <link linkend="sql-createsubscription-with-binary"><literal>binary</literal></link>,
+      <link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>,
+      <link linkend="sql-createsubscription-with-disable-on-error"><literal>disable_on_error</literal></link>,
+      and <link linkend="sql-createsubscription-with-origin"><literal>origin</literal></link>.
      </para>
     </listitem>
    </varlistentry>
@@ -233,8 +237,9 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
       resolved.  By using the <command>ALTER SUBSCRIPTION ... SKIP</command> command,
       the logical replication worker skips all data modification changes within
       the transaction.  This option has no effect on the transactions that are
-      already prepared by enabling <literal>two_phase</literal> on
-      subscriber.
+      already prepared by enabling
+      <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+      on the subscriber.
       After the logical replication worker successfully skips the transaction or
       finishes a transaction, the LSN (stored in
       <structname>pg_subscription</structname>.<structfield>subskiplsn</structfield>)
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 9d4b9d4e33..a66b8025f3 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -61,7 +61,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-name">
     <term><replaceable class="parameter">subscription_name</replaceable></term>
     <listitem>
      <para>
@@ -70,7 +70,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-connection">
     <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
     <listitem>
      <para>
@@ -81,7 +81,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-publication">
     <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]</literal></term>
     <listitem>
      <para>
@@ -90,7 +90,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-with">
     <term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -102,7 +102,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-connect">
         <term><literal>connect</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -129,7 +129,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-create-slot">
         <term><literal>create_slot</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -145,7 +145,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-enabled">
         <term><literal>enabled</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -156,7 +156,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-slot-name">
         <term><literal>slot_name</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -185,7 +185,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry id="sql-createsubscription-binary" xreflabel="binary">
+       <varlistentry id="sql-createsubscription-with-binary">
         <term><literal>binary</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-copy-data">
         <term><literal>copy_data</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -243,7 +243,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-streaming">
         <term><literal>streaming</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -271,7 +271,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-synchronous-commit">
         <term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -303,7 +303,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-two-phase">
         <term><literal>two_phase</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -334,7 +334,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-disable-on-error">
         <term><literal>disable_on_error</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -346,7 +346,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-origin">
         <term><literal>origin</literal> (<type>string</type>)</term>
         <listitem>
          <para>
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index d6b1faa804..77299878e0 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1458,9 +1458,9 @@ CREATE DATABASE foo WITH TEMPLATE template0;
    truncate the target tables before initiating a new full table copy.  If users
    intend to copy initial data during refresh they must create the slot with
    <literal>two_phase = false</literal>.  After the initial sync, the
-   <literal>two_phase</literal> option will be automatically enabled by the
-   subscriber if the subscription had been originally created with
-   <literal>two_phase = true</literal> option.
+   <link linkend="sql-createsubscription-with-two-phase"><literal>two_phase</literal></link>
+   option will be automatically enabled by the subscriber if the subscription
+   had been originally created with <literal>two_phase = true</literal> option.
   </para>
  </refsect1>
 
-- 
2.28.0.windows.1

#16Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: Amit Kapila (#15)
RE: PGdoc: add missing ID attribute to create_subscription.sgml

Dear Amit-san,

There is no need to break the link line. See attached.

I understood your saying. I think it's better.

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

#17Amit Kapila
amit.kapila16@gmail.com
In reply to: Hayato Kuroda (Fujitsu) (#16)
Re: PGdoc: add missing ID attribute to create_subscription.sgml

On Wed, Mar 29, 2023 at 6:31 AM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:

Dear Amit-san,

There is no need to break the link line. See attached.

I understood your saying. I think it's better.

Pushed.

--
With Regards,
Amit Kapila.