diff --git a/doc/src/sgml/amcheck.sgml b/doc/src/sgml/amcheck.sgml
index 5d61a33936..923cbde9dd 100644
--- a/doc/src/sgml/amcheck.sgml
+++ b/doc/src/sgml/amcheck.sgml
@@ -52,7 +52,7 @@
   able to infer something of the data itself from such messages.
  </para>
 
- <sect2>
+ <sect2 id="amcheck-functions">
   <title>Functions</title>
 
   <variablelist>
@@ -346,7 +346,7 @@ SET client_min_messages = DEBUG1;
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="amcheck-optional-heapallindexed-verification">
   <title>Optional <parameter>heapallindexed</parameter> Verification</title>
  <para>
   When the <parameter>heapallindexed</parameter> argument to B-Tree
@@ -387,7 +387,7 @@ SET client_min_messages = DEBUG1;
 
  </sect2>
 
- <sect2>
+ <sect2 id="amcheck-using-amcheck-effectively">
   <title>Using <filename>amcheck</filename> Effectively</title>
 
  <para>
@@ -535,7 +535,7 @@ SET client_min_messages = DEBUG1;
  </para>
 
  </sect2>
- <sect2>
+ <sect2 id="amcheck-repairing-corruption">
   <title>Repairing Corruption</title>
  <para>
   No error concerning corruption raised by <filename>amcheck</filename> should
diff --git a/doc/src/sgml/arch-dev.sgml b/doc/src/sgml/arch-dev.sgml
index 1315ce962d..e90ad6ec09 100644
--- a/doc/src/sgml/arch-dev.sgml
+++ b/doc/src/sgml/arch-dev.sgml
@@ -178,7 +178,7 @@
     </itemizedlist>
    </para>
 
-   <sect2>
+   <sect2 id="parser-stage-parser">
     <title>Parser</title>
 
     <para>
@@ -241,7 +241,7 @@
 
    </sect2>
 
-   <sect2>
+   <sect2 id="parser-stage-transformation-process">
      <title>Transformation Process</title>
 
     <para>
@@ -365,7 +365,7 @@
     and plans.
    </para>
 
-   <sect2>
+   <sect2 id="planner-optimizer-generatingepossible-plans">
     <title>Generating Possible Plans</title>
 
     <para>
diff --git a/doc/src/sgml/auth-delay.sgml b/doc/src/sgml/auth-delay.sgml
index 3bc9cfb207..40629311b1 100644
--- a/doc/src/sgml/auth-delay.sgml
+++ b/doc/src/sgml/auth-delay.sgml
@@ -21,7 +21,7 @@
   <xref linkend="guc-shared-preload-libraries"/> in <filename>postgresql.conf</filename>.
  </para>
 
- <sect2>
+ <sect2 id="auth-delay-configuration-parameters">
   <title>Configuration Parameters</title>
 
   <variablelist>
@@ -54,7 +54,7 @@ auth_delay.milliseconds = '500'
 </programlisting>
  </sect2>
 
- <sect2>
+ <sect2 id="auth-delay-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/auto-explain.sgml b/doc/src/sgml/auto-explain.sgml
index 394fec94e8..d63feded07 100644
--- a/doc/src/sgml/auto-explain.sgml
+++ b/doc/src/sgml/auto-explain.sgml
@@ -32,7 +32,7 @@ LOAD 'auto_explain';
   that.
  </para>
 
- <sect2>
+ <sect2 id="auto-explain-configuration-parameters">
   <title>Configuration Parameters</title>
 
  <para>
@@ -43,7 +43,7 @@ LOAD 'auto_explain';
  </para>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_min_duration">
     <term>
      <varname>auto_explain.log_min_duration</varname> (<type>integer</type>)
      <indexterm>
@@ -63,7 +63,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_parameter_max_length">
     <term>
      <varname>auto_explain.log_parameter_max_length</varname> (<type>integer</type>)
      <indexterm>
@@ -82,7 +82,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_analyze">
     <term>
      <varname>auto_explain.log_analyze</varname> (<type>boolean</type>)
      <indexterm>
@@ -108,7 +108,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_buffers">
     <term>
      <varname>auto_explain.log_buffers</varname> (<type>boolean</type>)
      <indexterm>
@@ -128,7 +128,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_wal">
     <term>
      <varname>auto_explain.log_wal</varname> (<type>boolean</type>)
      <indexterm>
@@ -148,7 +148,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_timing">
     <term>
      <varname>auto_explain.log_timing</varname> (<type>boolean</type>)
      <indexterm>
@@ -172,7 +172,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_triggers">
     <term>
      <varname>auto_explain.log_triggers</varname> (<type>boolean</type>)
      <indexterm>
@@ -191,7 +191,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_verbose">
     <term>
      <varname>auto_explain.log_verbose</varname> (<type>boolean</type>)
      <indexterm>
@@ -209,7 +209,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_settings">
     <term>
      <varname>auto_explain.log_settings</varname> (<type>boolean</type>)
      <indexterm>
@@ -227,7 +227,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_format">
     <term>
      <varname>auto_explain.log_format</varname> (<type>enum</type>)
      <indexterm>
@@ -245,7 +245,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_level">
     <term>
      <varname>auto_explain.log_level</varname> (<type>enum</type>)
      <indexterm>
@@ -266,7 +266,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-log_nested_statements">
     <term>
      <varname>auto_explain.log_nested_statements</varname> (<type>boolean</type>)
      <indexterm>
@@ -283,7 +283,7 @@ LOAD 'auto_explain';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="auto-explain-configuration-parameters-sample_rate">
     <term>
      <varname>auto_explain.sample_rate</varname> (<type>real</type>)
      <indexterm>
@@ -316,7 +316,7 @@ auto_explain.log_min_duration = '3s'
 </programlisting>
  </sect2>
 
- <sect2>
+ <sect2 id="auto-explain-example">
   <title>Example</title>
 
 <programlisting>
@@ -348,7 +348,7 @@ LOG:  duration: 3.651 ms  plan:
 ]]></screen>
  </sect2>
 
- <sect2>
+ <sect2 id="auto-explain-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/basebackup-to-shell.sgml b/doc/src/sgml/basebackup-to-shell.sgml
index b2ecc373eb..f74535faae 100644
--- a/doc/src/sgml/basebackup-to-shell.sgml
+++ b/doc/src/sgml/basebackup-to-shell.sgml
@@ -27,7 +27,7 @@
   <xref linkend="guc-local-preload-libraries"/>.
  </para>
 
- <sect2>
+ <sect2 id="basebackup-to-shell-config-params">
   <title>Configuration Parameters</title>
 
   <variablelist>
@@ -74,7 +74,7 @@
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="basebackup-to-shell-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/basic-archive.sgml b/doc/src/sgml/basic-archive.sgml
index 0b650f17a8..60f23d2855 100644
--- a/doc/src/sgml/basic-archive.sgml
+++ b/doc/src/sgml/basic-archive.sgml
@@ -21,7 +21,7 @@
   must be enabled.
  </para>
 
- <sect2>
+ <sect2 id="basic-archive-configuration-parameters">
   <title>Configuration Parameters</title>
 
   <variablelist>
@@ -57,7 +57,7 @@ basic_archive.archive_directory = '/path/to/archive/directory'
 </programlisting>
  </sect2>
 
- <sect2>
+ <sect2 id="basic-archive-notes">
   <title>Notes</title>
 
   <para>
@@ -70,7 +70,7 @@ basic_archive.archive_directory = '/path/to/archive/directory'
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="basic-archive-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/bloom.sgml b/doc/src/sgml/bloom.sgml
index a3f51cfdc4..98d0316175 100644
--- a/doc/src/sgml/bloom.sgml
+++ b/doc/src/sgml/bloom.sgml
@@ -38,7 +38,7 @@
   indexes can also perform inequality and range searches.
  </para>
 
- <sect2>
+ <sect2 id="bloom-parameters">
   <title>Parameters</title>
 
   <para>
@@ -73,7 +73,7 @@
    </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="bloom-examples">
   <title>Examples</title>
 
   <para>
@@ -215,7 +215,7 @@ CREATE INDEX
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="bloom-operator-class-interface">
   <title>Operator Class Interface</title>
 
   <para>
@@ -232,7 +232,7 @@ DEFAULT FOR TYPE text USING bloom AS
 </programlisting>
  </sect2>
 
- <sect2>
+ <sect2 id="bloom-limitations">
   <title>Limitations</title>
   <para>
    <itemizedlist>
@@ -268,7 +268,7 @@ DEFAULT FOR TYPE text USING bloom AS
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="bloom-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/btree-gin.sgml b/doc/src/sgml/btree-gin.sgml
index 5bc5a054e8..870c25559e 100644
--- a/doc/src/sgml/btree-gin.sgml
+++ b/doc/src/sgml/btree-gin.sgml
@@ -38,7 +38,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="btree-gin-example-usage">
   <title>Example Usage</title>
 
 <programlisting>
@@ -51,7 +51,7 @@ SELECT * FROM test WHERE a &lt; 10;
 
  </sect2>
 
- <sect2>
+ <sect2 id="btree-gin-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/btree-gist.sgml b/doc/src/sgml/btree-gist.sgml
index b67f20a00f..92aa8e277e 100644
--- a/doc/src/sgml/btree-gist.sgml
+++ b/doc/src/sgml/btree-gist.sgml
@@ -58,7 +58,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="btree-gist-example-usage">
   <title>Example Usage</title>
 
   <para>
@@ -101,7 +101,7 @@ INSERT 0 1
 
  </sect2>
 
- <sect2>
+ <sect2 id="btree-gist-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/charset.sgml b/doc/src/sgml/charset.sgml
index 445fd175d8..7674cf1d0c 100644
--- a/doc/src/sgml/charset.sgml
+++ b/doc/src/sgml/charset.sgml
@@ -46,7 +46,7 @@
    system.
   </para>
 
-  <sect2>
+  <sect2 id="locale-overview">
    <title>Overview</title>
 
    <para>
@@ -206,7 +206,7 @@ initdb --locale=sv_SE
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="locale-behavior">
    <title>Behavior</title>
 
    <para>
@@ -276,7 +276,7 @@ initdb --locale=sv_SE
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="selecting-locales">
    <title>Selecting Locales</title>
 
    <para>
@@ -338,7 +338,7 @@ initdb --locale=sv_SE
    </orderedlist>
   </sect2>
 
-  <sect2>
+  <sect2 id="locale-providers">
    <title>Locale Providers</title>
 
    <para>
@@ -378,7 +378,7 @@ initdb --locale-provider=icu --icu-locale=en
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="locale-problems">
    <title>Problems</title>
 
    <para>
@@ -440,7 +440,7 @@ initdb --locale-provider=icu --icu-locale=en
    of a database cannot be changed after its creation.
   </para>
 
-  <sect2>
+  <sect2 id="collation-concepts">
    <title>Concepts</title>
 
    <para>
@@ -642,7 +642,7 @@ SELECT * FROM test1 ORDER BY a || b COLLATE "fr_FR";
     a database.
    </para>
 
-   <sect3>
+   <sect3 id="collation-managing-standard">
     <title>Standard Collations</title>
 
    <para>
@@ -665,7 +665,7 @@ SELECT * FROM test1 ORDER BY a || b COLLATE "fr_FR";
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="collation-managing-predefined">
    <title>Predefined Collations</title>
 
    <para>
@@ -684,7 +684,7 @@ SELECT * FROM test1 ORDER BY a || b COLLATE "fr_FR";
     in <application>psql</application>.
    </para>
 
-  <sect4>
+  <sect4 id="collation-managing-predefined-libc">
    <title>libc Collations</title>
 
    <para>
@@ -741,7 +741,7 @@ SELECT a COLLATE "C" &lt; b COLLATE "POSIX" FROM test1;
    </para>
   </sect4>
 
-  <sect4>
+  <sect4 id="collation-managing-predefined-icu">
    <title>ICU Collations</title>
 
    <para>
@@ -760,14 +760,14 @@ SELECT a COLLATE "C" &lt; b COLLATE "POSIX" FROM test1;
     Here are some example collations that might be created:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="collation-managing-predefined-icu-de-x-icu">
       <term><literal>de-x-icu</literal></term>
       <listitem>
        <para>German collation, default variant</para>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="collation-managing-predefined-icu-de-at-x-icu">
       <term><literal>de-AT-x-icu</literal></term>
       <listitem>
        <para>German collation for Austria, default variant</para>
@@ -779,7 +779,7 @@ SELECT a COLLATE "C" &lt; b COLLATE "POSIX" FROM test1;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="collation-managing-predefined-icu-und-x-icu">
       <term><literal>und-x-icu</literal> (for <quote>undefined</quote>)</term>
       <listitem>
        <para>
@@ -817,7 +817,7 @@ SELECT a COLLATE "C" &lt; b COLLATE "POSIX" FROM test1;
     ensures that they are saved by <command>pg_dump</command>.
    </para>
 
-   <sect4>
+   <sect4 id="collation-managing-create-libc">
     <title>libc Collations</title>
 
     <para>
@@ -841,7 +841,7 @@ CREATE COLLATION german (provider = libc, locale = 'de_DE');
     </para>
    </sect4>
 
-   <sect4>
+   <sect4 id="collation-managing-create-icu">
     <title>ICU Collations</title>
 
    <para>
@@ -859,7 +859,7 @@ CREATE COLLATION german (provider = libc, locale = 'de_DE');
     Here are some examples:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="collation-managing-create-icu-de-u-co-phonebk-x-icu">
       <term><literal>CREATE COLLATION "de-u-co-phonebk-x-icu" (provider = icu, locale = 'de-u-co-phonebk');</literal></term>
       <term><literal>CREATE COLLATION "de-u-co-phonebk-x-icu" (provider = icu, locale = 'de@collation=phonebook');</literal></term>
       <listitem>
@@ -879,7 +879,7 @@ CREATE COLLATION german (provider = libc, locale = 'de_DE');
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="collation-managing-create-icu-und-u-co-emoji-x-icu">
       <term><literal>CREATE COLLATION "und-u-co-emoji-x-icu" (provider = icu, locale = 'und-u-co-emoji');</literal></term>
       <term><literal>CREATE COLLATION "und-u-co-emoji-x-icu" (provider = icu, locale = '@collation=emoji');</literal></term>
       <listitem>
@@ -893,7 +893,7 @@ CREATE COLLATION german (provider = libc, locale = 'de_DE');
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="collation-managing-create-icu-en-u-kr-grek-latn">
       <term><literal>CREATE COLLATION latinlast (provider = icu, locale = 'en-u-kr-grek-latn');</literal></term>
       <term><literal>CREATE COLLATION latinlast (provider = icu, locale = 'en@colReorder=grek-latn');</literal></term>
       <listitem>
@@ -903,7 +903,7 @@ CREATE COLLATION german (provider = libc, locale = 'de_DE');
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="collation-managing-create-icu-en-u-kf-upper">
       <term><literal>CREATE COLLATION upperfirst (provider = icu, locale = 'en-u-kf-upper');</literal></term>
       <term><literal>CREATE COLLATION upperfirst (provider = icu, locale = 'en@colCaseFirst=upper');</literal></term>
       <listitem>
@@ -914,7 +914,7 @@ CREATE COLLATION german (provider = libc, locale = 'de_DE');
       </listitem>
      </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="collation-managing-create-icu-en-u-kf-upper-kr-grek-latn">
       <term><literal>CREATE COLLATION special (provider = icu, locale = 'en-u-kf-upper-kr-grek-latn');</literal></term>
       <term><literal>CREATE COLLATION special (provider = icu, locale = 'en@colCaseFirst=upper;colReorder=grek-latn');</literal></term>
       <listitem>
@@ -924,7 +924,7 @@ CREATE COLLATION german (provider = libc, locale = 'de_DE');
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="collation-managing-create-icu-en-u-kn-true">
       <term><literal>CREATE COLLATION numeric (provider = icu, locale = 'en-u-kn-true');</literal></term>
       <term><literal>CREATE COLLATION numeric (provider = icu, locale = 'en@colNumeric=yes');</literal></term>
       <listitem>
@@ -1522,7 +1522,7 @@ CREATE COLLATION ignore_accents (provider = icu, locale = 'und-u-ks-level1-kc-tr
      </para>
     </sect2>
 
-   <sect2>
+   <sect2 id="multibyte-setting">
     <title>Setting the Character Set</title>
 
     <para>
@@ -1610,7 +1610,7 @@ $ <userinput>psql -l</userinput>
     </important>
    </sect2>
 
-   <sect2>
+   <sect2 id="multibyte-automatic-conversion">
     <title>Automatic Character Set Conversion Between Server and Client</title>
 
     <para>
@@ -2692,7 +2692,7 @@ RESET client_encoding;
     </table>
    </sect2>
 
-   <sect2>
+   <sect2 id="multibyte-further-reading">
     <title>Further Reading</title>
 
     <para>
diff --git a/doc/src/sgml/citext.sgml b/doc/src/sgml/citext.sgml
index 5986601327..3df2825592 100644
--- a/doc/src/sgml/citext.sgml
+++ b/doc/src/sgml/citext.sgml
@@ -30,7 +30,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="citext-rationale">
   <title>Rationale</title>
 
   <para>
@@ -84,7 +84,7 @@ SELECT * FROM tab WHERE lower(col) = LOWER(?);
 
  </sect2>
 
- <sect2>
+ <sect2 id="citext-how-to-use-it">
   <title>How to Use It</title>
 
   <para>
@@ -111,7 +111,7 @@ SELECT * FROM users WHERE nick = 'Larry';
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="citext-string-comparison-behavior">
   <title>String Comparison Behavior</title>
 
   <para>
@@ -196,7 +196,7 @@ SELECT * FROM users WHERE nick = 'Larry';
 
  </sect2>
 
- <sect2>
+ <sect2 id="citext-limitations">
   <title>Limitations</title>
 
    <itemizedlist>
@@ -277,7 +277,7 @@ SELECT * FROM users WHERE nick = 'Larry';
    </itemizedlist>
  </sect2>
 
- <sect2>
+ <sect2 id="citext-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 05b3862d09..6ac9a70ba5 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -215,7 +215,7 @@ shared_buffers = 128MB
     </para>
    </sect2>
 
-   <sect2 id="config-setting-sql-command-interaction">
+   <sect2 id="config-setting-sql">
     <title>Parameter Interaction via SQL</title>
 
      <para>
@@ -1355,7 +1355,7 @@ include_dir 'conf.d'
        <para>
         Explanation of the default value:
         <variablelist>
-         <varlistentry>
+         <varlistentry id="guc-ssl-ciphers-high">
           <term><literal>HIGH</literal></term>
           <listitem>
            <para>
@@ -1365,7 +1365,7 @@ include_dir 'conf.d'
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="guc-ssl-ciphers-medium">
           <term><literal>MEDIUM</literal></term>
           <listitem>
            <para>
@@ -1375,7 +1375,7 @@ include_dir 'conf.d'
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="guc-ssl-ciphers-plus-3des">
           <term><literal>+3DES</literal></term>
           <listitem>
            <para>
@@ -1389,7 +1389,7 @@ include_dir 'conf.d'
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="guc-ssl-ciphers-not-anull">
           <term><literal>!aNULL</literal></term>
           <listitem>
            <para>
@@ -6928,7 +6928,7 @@ local0.*    /var/log/postgresql
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="guc-debug_print_parse-et-al">
       <term><varname>debug_print_parse</varname> (<type>boolean</type>)
       <indexterm>
        <primary><varname>debug_print_parse</varname> configuration parameter</primary>
@@ -6959,7 +6959,7 @@ local0.*    /var/log/postgresql
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="guc-debug_pretty_print">
       <term><varname>debug_pretty_print</varname> (<type>boolean</type>)
       <indexterm>
        <primary><varname>debug_pretty_print</varname> configuration parameter</primary>
@@ -7889,7 +7889,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
      </table>
     </sect2>
 
-   <sect2>
+   <sect2 id="runtime-config-logging-proc-title">
     <title>Process Title</title>
 
     <para>
@@ -8177,7 +8177,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="guc-log_statement_stats-et-al">
       <term><varname>log_statement_stats</varname> (<type>boolean</type>)
       <indexterm>
        <primary><varname>log_statement_stats</varname> configuration parameter</primary>
diff --git a/doc/src/sgml/contrib-spi.sgml b/doc/src/sgml/contrib-spi.sgml
index fed6f24932..f4b0a01a81 100644
--- a/doc/src/sgml/contrib-spi.sgml
+++ b/doc/src/sgml/contrib-spi.sgml
@@ -24,7 +24,7 @@
   separately-installable extension.
  </para>
 
- <sect2>
+ <sect2 id="contrib-spi-refint">
   <title>refint &mdash; Functions for Implementing Referential Integrity</title>
 
   <para>
@@ -65,7 +65,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="contrib-spi-autoinc">
   <title>autoinc &mdash; Functions for Autoincrementing Fields</title>
 
   <para>
@@ -92,7 +92,7 @@
 
  </sect2>
 
- <sect2>
+ <sect2 id="contrib-spi-insert_username">
   <title>insert_username &mdash; Functions for Tracking Who Changed a Table</title>
 
   <para>
@@ -113,7 +113,7 @@
 
  </sect2>
 
- <sect2>
+ <sect2 id="contrib-spi-moddatetime">
   <title>moddatetime &mdash; Functions for Tracking Last Modification Time</title>
 
   <para>
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 52506fc822..0744816e7c 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -18,7 +18,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="cube-syntax">
   <title>Syntax</title>
 
   <para>
@@ -99,7 +99,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="cube-precision">
   <title>Precision</title>
 
   <para>
@@ -108,7 +108,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="cube-usage">
   <title>Usage</title>
 
   <para>
@@ -533,7 +533,7 @@ SELECT c FROM test ORDER BY c ~&gt; 3 DESC LIMIT 5;
   </table>
  </sect2>
 
- <sect2>
+ <sect2 id="cube-defaults">
   <title>Defaults</title>
 
   <para>
@@ -587,7 +587,7 @@ t
 </programlisting>
  </sect2>
 
- <sect2>
+ <sect2 id="cube-notes">
   <title>Notes</title>
 
   <para>
@@ -601,7 +601,7 @@ t
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="cube-credits">
   <title>Credits</title>
 
   <para>
diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index fdffba4442..467b49b199 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -1471,7 +1471,7 @@ SELECT b, char_length(b) FROM test2;
     mostly the same.
    </para>
 
-  <sect2>
+  <sect2 id="datatype-binary-bytea-hex-format">
    <title><type>bytea</type> Hex Format</title>
 
    <para>
@@ -1498,7 +1498,7 @@ SELECT '\xDEADBEEF';
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="datatype-binary-bytea-escape-format">
    <title><type>bytea</type> Escape Format</title>
 
    <para>
@@ -1904,7 +1904,7 @@ MINUTE TO SECOND
      more than 6 digits).
     </para>
 
-    <sect3>
+    <sect3 id="datatype-datetime-input-dates">
     <title>Dates</title>
 
     <indexterm>
@@ -2003,7 +2003,7 @@ MINUTE TO SECOND
      </table>
     </sect3>
 
-    <sect3>
+    <sect3 id="datatype-datetime-input-times">
      <title>Times</title>
 
      <indexterm>
@@ -2167,7 +2167,7 @@ MINUTE TO SECOND
     </para>
     </sect3>
 
-    <sect3>
+    <sect3 id="datatype-datetime-input-time-stamps">
     <title>Time Stamps</title>
 
     <indexterm>
@@ -3172,7 +3172,7 @@ SELECT * FROM test1 WHERE a;
     a piece of data.
    </para>
 
-   <sect2>
+   <sect2 id="datatype-enum-declaration">
     <title>Declaration of Enumerated Types</title>
 
     <para>
@@ -3202,7 +3202,7 @@ SELECT * FROM person WHERE current_mood = 'happy';
     </para>
     </sect2>
 
-    <sect2>
+    <sect2 id="datatype-enum-ordering">
      <title>Ordering</title>
 
      <para>
@@ -3239,7 +3239,7 @@ WHERE current_mood = (SELECT MIN(current_mood) FROM person);
      </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="datatype-enum-type-safety">
     <title>Type Safety</title>
 
     <para>
@@ -3279,7 +3279,7 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="datatype-enum-implementation-details">
     <title>Implementation Details</title>
 
     <para>
@@ -3396,7 +3396,7 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
     intersections.  They are explained in <xref linkend="functions-geometry"/>.
    </para>
 
-   <sect2>
+   <sect2 id="datatype-geometric-points">
     <title>Points</title>
 
     <indexterm>
@@ -3490,7 +3490,7 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="datatype-geometric-boxes">
     <title>Boxes</title>
 
     <indexterm>
@@ -3531,7 +3531,7 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="datatype-geometric-paths">
     <title>Paths</title>
 
     <indexterm>
@@ -4422,7 +4422,7 @@ a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11
     can be found in <xref linkend="xml-limits-conformance"/>.
    </para>
 
-   <sect2>
+   <sect2 id="datatype-xml-creating">
     <title>Creating XML Values</title>
    <para>
     To produce a value of type <type>xml</type> from character data,
@@ -4492,7 +4492,7 @@ SET xmloption TO { DOCUMENT | CONTENT };
 
    </sect2>
 
-   <sect2>
+   <sect2 id="datatype-xml-encoding-handling">
     <title>Encoding Handling</title>
    <para>
     Care must be taken when dealing with multiple character encodings
@@ -4550,7 +4550,7 @@ SET xmloption TO { DOCUMENT | CONTENT };
    </caution>
    </sect2>
 
-   <sect2>
+   <sect2 id="datatype-xml-accessing-xml-values">
    <title>Accessing XML Values</title>
 
    <para>
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 6e92bbddd2..9434acd182 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -602,7 +602,7 @@ CREATE TABLE products (
    </note>
   </sect2>
 
-  <sect2>
+  <sect2 id="ddl-constraints-not-null">
    <title>Not-Null Constraints</title>
 
    <indexterm>
@@ -1230,7 +1230,7 @@ CREATE TABLE circles (
   </indexterm>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="ddl-system-columns-tableoid">
     <term><structfield>tableoid</structfield></term>
     <listitem>
      <indexterm>
@@ -1250,7 +1250,7 @@ CREATE TABLE circles (
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="ddl-system-columns-xmin">
     <term><structfield>xmin</structfield></term>
     <listitem>
      <indexterm>
@@ -1266,7 +1266,7 @@ CREATE TABLE circles (
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="ddl-system-columns-cmin">
     <term><structfield>cmin</structfield></term>
     <listitem>
      <indexterm>
@@ -1280,7 +1280,7 @@ CREATE TABLE circles (
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="ddl-system-columns-xmax">
     <term><structfield>xmax</structfield></term>
     <listitem>
      <indexterm>
@@ -1297,7 +1297,7 @@ CREATE TABLE circles (
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="ddl-system-columns-cmax">
     <term><structfield>cmax</structfield></term>
     <listitem>
      <indexterm>
@@ -1310,7 +1310,7 @@ CREATE TABLE circles (
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="ddl-system-columns-ctid">
     <term><structfield>ctid</structfield></term>
     <listitem>
      <indexterm>
@@ -1558,7 +1558,7 @@ ALTER TABLE products ALTER COLUMN product_no DROP NOT NULL;
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="ddl-alter-column-default">
    <title>Changing a Column's Default Value</title>
 
    <indexterm>
@@ -1587,7 +1587,7 @@ ALTER TABLE products ALTER COLUMN price DROP DEFAULT;
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="ddl-alter-column-type">
    <title>Changing a Column's Data Type</title>
 
    <indexterm>
@@ -1616,7 +1616,7 @@ ALTER TABLE products ALTER COLUMN price TYPE numeric(10,2);
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="ddl-alter-renaming-column">
    <title>Renaming a Column</title>
 
    <indexterm>
@@ -1632,7 +1632,7 @@ ALTER TABLE products RENAME COLUMN product_no TO product_number;
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="ddl-alter-renaming-table">
    <title>Renaming a Table</title>
 
    <indexterm>
@@ -1768,7 +1768,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
    The available privileges are:
 
    <variablelist>
-    <varlistentry>
+    <varlistentry id="ddl-priv-select">
      <term><literal>SELECT</literal></term>
      <listitem>
       <para>
@@ -1785,7 +1785,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-insert">
      <term><literal>INSERT</literal></term>
      <listitem>
       <para>
@@ -1798,7 +1798,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-update">
      <term><literal>UPDATE</literal></term>
      <listitem>
       <para>
@@ -1820,7 +1820,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-delete">
      <term><literal>DELETE</literal></term>
      <listitem>
       <para>
@@ -1832,7 +1832,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-truncate">
      <term><literal>TRUNCATE</literal></term>
      <listitem>
       <para>
@@ -1841,7 +1841,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-references">
      <term><literal>REFERENCES</literal></term>
      <listitem>
       <para>
@@ -1851,7 +1851,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-trigger">
      <term><literal>TRIGGER</literal></term>
      <listitem>
       <para>
@@ -1860,7 +1860,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-create">
      <term><literal>CREATE</literal></term>
      <listitem>
       <para>
@@ -1886,7 +1886,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-connect">
      <term><literal>CONNECT</literal></term>
      <listitem>
       <para>
@@ -1897,7 +1897,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-temporary">
      <term><literal>TEMPORARY</literal></term>
      <listitem>
       <para>
@@ -1906,7 +1906,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-execute">
      <term><literal>EXECUTE</literal></term>
      <listitem>
       <para>
@@ -1917,7 +1917,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-usage">
      <term><literal>USAGE</literal></term>
      <listitem>
       <para>
@@ -1961,7 +1961,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-set">
      <term><literal>SET</literal></term>
      <listitem>
       <para>
@@ -1973,7 +1973,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-alter_system">
      <term><literal>ALTER SYSTEM</literal></term>
      <listitem>
       <para>
@@ -1983,7 +1983,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="ddl-priv-maintain">
     <term><literal>MAINTAIN</literal></term>
     <listitem>
      <para>
@@ -3748,7 +3748,7 @@ VALUES ('Albany', NULL, NULL, 'NY');
      following forms of partitioning:
 
      <variablelist>
-      <varlistentry>
+      <varlistentry id="ddl-partitioning-overview-range">
        <term>Range Partitioning</term>
 
        <listitem>
@@ -3769,7 +3769,7 @@ VALUES ('Albany', NULL, NULL, 'NY');
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="ddl-partitioning-overview-list">
        <term>List Partitioning</term>
 
        <listitem>
@@ -3780,7 +3780,7 @@ VALUES ('Albany', NULL, NULL, 'NY');
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="ddl-partitioning-overview-hash">
        <term>Hash Partitioning</term>
 
        <listitem>
diff --git a/doc/src/sgml/dict-int.sgml b/doc/src/sgml/dict-int.sgml
index 8babfdd5c2..53ae8b6637 100644
--- a/doc/src/sgml/dict-int.sgml
+++ b/doc/src/sgml/dict-int.sgml
@@ -21,7 +21,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="dict-int-config">
   <title>Configuration</title>
 
   <para>
@@ -58,7 +58,7 @@
   </itemizedlist>
  </sect2>
 
- <sect2>
+ <sect2 id="dict-int-usage">
   <title>Usage</title>
 
   <para>
diff --git a/doc/src/sgml/dict-xsyn.sgml b/doc/src/sgml/dict-xsyn.sgml
index 256aff7c58..27b24628d4 100644
--- a/doc/src/sgml/dict-xsyn.sgml
+++ b/doc/src/sgml/dict-xsyn.sgml
@@ -14,7 +14,7 @@
   search for a word using any of its synonyms.
  </para>
 
- <sect2>
+ <sect2 id="dict-xsyn-config">
   <title>Configuration</title>
 
   <para>
@@ -83,7 +83,7 @@ word syn1 syn2 syn3
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="dict-xsyn-usage">
   <title>Usage</title>
 
   <para>
diff --git a/doc/src/sgml/docguide.sgml b/doc/src/sgml/docguide.sgml
index e1bac68604..787caef70d 100644
--- a/doc/src/sgml/docguide.sgml
+++ b/doc/src/sgml/docguide.sgml
@@ -79,7 +79,7 @@
    might be optional, as noted.
 
    <variablelist>
-    <varlistentry>
+    <varlistentry id="docguide-toolsets-docbook-dtd">
      <term><ulink url="https://www.oasis-open.org/docbook/">DocBook DTD</ulink></term>
      <listitem>
       <para>
@@ -91,7 +91,7 @@
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="docguide-toolsets-docbook-xsl">
      <term><ulink url="https://github.com/docbook/wiki/wiki/DocBookXslStylesheets">DocBook XSL Stylesheets</ulink></term>
      <listitem>
       <para>
@@ -107,7 +107,7 @@
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="docguide-toolsets-libxml2">
      <term><ulink url="http://xmlsoft.org/">Libxml2</ulink> for <command>xmllint</command></term>
      <listitem>
       <para>
@@ -121,7 +121,7 @@
      </listitem>
      </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="docguide-toolsets-libxslt">
      <term><ulink url="http://xmlsoft.org/XSLT/">Libxslt</ulink> for <command>xsltproc</command></term>
      <listitem>
       <para>
@@ -131,7 +131,7 @@
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="docguide-toolsets-fop">
      <term><ulink url="https://xmlgraphics.apache.org/fop/">FOP</ulink></term>
      <listitem>
       <para>
@@ -163,7 +163,7 @@
    for an example.
   </para>
 
-  <sect2>
+  <sect2 id="docguide-toolsets-inst-fedora-et-al">
    <title>Installation on Fedora, RHEL, and Derivatives</title>
 
    <para>
@@ -174,7 +174,7 @@ yum install docbook-dtds docbook-style-xsl fop libxslt
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="docguide-toolsets-inst-freebsd">
    <title>Installation on FreeBSD</title>
 
    <para>
@@ -191,7 +191,7 @@ pkg install docbook-xml docbook-xsl fop libxslt
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="docguide-toolsets-inst-debian">
    <title>Debian Packages</title>
 
    <para>
@@ -204,7 +204,7 @@ apt-get install docbook-xml docbook-xsl fop libxml2-utils xsltproc
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="docguide-toolsets-inst-macos">
    <title>macOS</title>
 
    <para>
@@ -274,7 +274,7 @@ checking for dbtoepub... dbtoepub
    documentation. (Remember to use GNU make.)
   </para>
 
-  <sect2>
+  <sect2 id="docguide-build-html">
    <title>HTML</title>
 
    <para>
@@ -303,7 +303,7 @@ checking for dbtoepub... dbtoepub
    </para>
  </sect2>
 
- <sect2>
+ <sect2 id="docguide-build-manpages">
   <title>Manpages</title>
 
   <para>
@@ -317,7 +317,7 @@ checking for dbtoepub... dbtoepub
   </para>
  </sect2>
 
-  <sect2>
+  <sect2 id="docguide-build-pdf">
    <title>PDF</title>
 
    <para>
@@ -373,7 +373,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="docguide-build-plain-text">
    <title>Plain Text Files</title>
 
    <para>
@@ -395,7 +395,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="docguide-build-syntax-check">
    <title>Syntax Check</title>
 
    <para>
@@ -427,7 +427,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
     correct mode.
    </para>
 
-   <sect2>
+   <sect2 id="docguide-authoring-emacs">
     <title>Emacs</title>
 
     <para>
@@ -453,7 +453,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
  <sect1 id="docguide-style">
   <title>Style Guide</title>
 
-  <sect2>
+  <sect2 id="docguide-style-ref-pages">
    <title>Reference Pages</title>
 
    <para>
@@ -476,7 +476,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
     <quote>Usage</quote> section.
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-name">
       <term>Name</term>
       <listitem>
        <para>
@@ -486,7 +486,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-synopsis">
       <term>Synopsis</term>
       <listitem>
        <para>
@@ -498,7 +498,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-description">
       <term>Description</term>
       <listitem>
        <para>
@@ -507,7 +507,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-options">
       <term>Options</term>
       <listitem>
        <para>
@@ -517,7 +517,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-exit-status">
       <term>Exit Status</term>
       <listitem>
        <para>
@@ -528,7 +528,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-usage">
       <term>Usage</term>
       <listitem>
        <para>
@@ -540,7 +540,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-environment">
       <term>Environment</term>
       <listitem>
        <para>
@@ -551,7 +551,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-files">
       <term>Files</term>
       <listitem>
        <para>
@@ -562,7 +562,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-diagnostics">
       <term>Diagnostics</term>
       <listitem>
        <para>
@@ -575,7 +575,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-notes">
       <term>Notes</term>
       <listitem>
        <para>
@@ -586,7 +586,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-examples">
       <term>Examples</term>
       <listitem>
        <para>
@@ -595,7 +595,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-history">
       <term>History</term>
       <listitem>
        <para>
@@ -606,7 +606,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-author">
       <term>Author</term>
       <listitem>
        <para>
@@ -615,7 +615,7 @@ ADDITIONAL_FLAGS='-Xmx1500m'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="docguide-style-ref-pages-see-also">
       <term>See Also</term>
       <listitem>
        <para>
diff --git a/doc/src/sgml/earthdistance.sgml b/doc/src/sgml/earthdistance.sgml
index 4377249c36..f15dde3a66 100644
--- a/doc/src/sgml/earthdistance.sgml
+++ b/doc/src/sgml/earthdistance.sgml
@@ -44,7 +44,7 @@
   </para>
  </caution>
 
- <sect2>
+ <sect2 id="earthdistance-cube-based">
   <title>Cube-Based Earth Distances</title>
 
   <para>
@@ -202,7 +202,7 @@
 
  </sect2>
 
- <sect2>
+ <sect2 id="earthdistance-point-based">
   <title>Point-Based Earth Distances</title>
 
   <para>
diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index 16853ced6f..c7a28a9a8e 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -584,7 +584,7 @@ EXEC SQL COMMIT;
     The following transaction management commands are available:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-transactions-exec-sql-commit">
       <term><literal>EXEC SQL COMMIT</literal></term>
       <listitem>
        <para>
@@ -593,7 +593,7 @@ EXEC SQL COMMIT;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-transactions-exec-sql-rollback">
       <term><literal>EXEC SQL ROLLBACK</literal></term>
       <listitem>
        <para>
@@ -602,7 +602,7 @@ EXEC SQL COMMIT;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-transactions-exec-sql-prepare-transaction">
       <term><literal>EXEC SQL PREPARE TRANSACTION </literal><replaceable class="parameter">transaction_id</replaceable></term>
       <listitem>
        <para>
@@ -611,7 +611,7 @@ EXEC SQL COMMIT;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-transactions-exec-sql-commit-prepared">
       <term><literal>EXEC SQL COMMIT PREPARED </literal><replaceable class="parameter">transaction_id</replaceable></term>
       <listitem>
        <para>
@@ -620,7 +620,7 @@ EXEC SQL COMMIT;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-transactions-exec-sql-rollback-prepared">
       <term><literal>EXEC SQL ROLLBACK PREPARED </literal><replaceable class="parameter">transaction_id</replaceable></term>
       <listitem>
        <para>
@@ -629,7 +629,7 @@ EXEC SQL COMMIT;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-transactions-exec-sql-autocommit-on">
       <term><literal>EXEC SQL SET AUTOCOMMIT TO ON</literal></term>
       <listitem>
        <para>
@@ -638,7 +638,7 @@ EXEC SQL COMMIT;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-transactions-exec-sql-autocommit-off">
       <term><literal>EXEC SQL SET AUTOCOMMIT TO OFF</literal></term>
       <listitem>
        <para>
@@ -1110,7 +1110,7 @@ struct varchar_var { int len; char arr[180]; } var;
      see <xref linkend="ecpg-pgtypes"/>.
     </para>
 
-    <sect4>
+    <sect4 id="ecpg-special-types-timestamp-date">
      <title>timestamp, date</title>
 
      <para>
@@ -1275,7 +1275,7 @@ EXEC SQL END DECLARE SECTION;
      </para>
     </sect4>
 
-    <sect4>
+    <sect4 id="ecpg-special-types-bytea">
      <title>bytea</title>
 
      <para>
@@ -1481,7 +1481,7 @@ EXEC SQL END DECLARE SECTION;
      </para>
     </sect4>
 
-    <sect4>
+    <sect4 id="ecpg-variables-nonprimitive-c-typedefs">
      <title>Typedefs</title>
      <indexterm>
       <primary>typedef</primary>
@@ -1538,7 +1538,7 @@ EXEC SQL START TRANSACTION;
      </note>
     </sect4>
 
-    <sect4>
+    <sect4 id="ecpg-variables-nonprimitive-c-pointers">
      <title>Pointers</title>
 
      <para>
@@ -1570,7 +1570,7 @@ EXEC SQL END DECLARE SECTION;
     nonprimitive types, described in the previous section.
    </para>
 
-   <sect3>
+   <sect3 id="ecpg-variables-nonprimitive-sql-arrays">
     <title>Arrays</title>
 
     <para>
@@ -1693,7 +1693,7 @@ while (1)
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="ecpg-variables-nonprimitive-sql-composite">
     <title>Composite Types</title>
 
     <para>
@@ -1813,7 +1813,7 @@ while (1)
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="ecpg-variables-nonprimitive-sql-user-defined-base-types">
     <title>User-Defined Base Types</title>
 
     <para>
@@ -2132,7 +2132,7 @@ PGTYPESchar_free(out);
    <para>
    The following functions can be used to work with the numeric type:
    <variablelist>
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-new">
      <term><function>PGTYPESnumeric_new</function></term>
      <listitem>
       <para>
@@ -2144,7 +2144,7 @@ numeric *PGTYPESnumeric_new(void);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-free">
      <term><function>PGTYPESnumeric_free</function></term>
      <listitem>
       <para>
@@ -2156,7 +2156,7 @@ void PGTYPESnumeric_free(numeric *var);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-from_asc">
      <term><function>PGTYPESnumeric_from_asc</function></term>
      <listitem>
       <para>
@@ -2179,7 +2179,7 @@ numeric *PGTYPESnumeric_from_asc(char *str, char **endptr);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-to_asc">
      <term><function>PGTYPESnumeric_to_asc</function></term>
      <listitem>
       <para>
@@ -2195,7 +2195,7 @@ char *PGTYPESnumeric_to_asc(numeric *num, int dscale);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-add">
      <term><function>PGTYPESnumeric_add</function></term>
      <listitem>
       <para>
@@ -2211,7 +2211,7 @@ int PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-sub">
      <term><function>PGTYPESnumeric_sub</function></term>
      <listitem>
       <para>
@@ -2227,7 +2227,7 @@ int PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-mul">
      <term><function>PGTYPESnumeric_mul</function></term>
      <listitem>
       <para>
@@ -2243,7 +2243,7 @@ int PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-div">
      <term><function>PGTYPESnumeric_div</function></term>
      <listitem>
       <para>
@@ -2259,7 +2259,7 @@ int PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-cmp">
      <term><function>PGTYPESnumeric_cmp</function></term>
      <listitem>
       <para>
@@ -2291,7 +2291,7 @@ int PGTYPESnumeric_cmp(numeric *var1, numeric *var2)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-from_int">
      <term><function>PGTYPESnumeric_from_int</function></term>
      <listitem>
       <para>
@@ -2306,7 +2306,7 @@ int PGTYPESnumeric_from_int(signed int int_val, numeric *var);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-from_long">
      <term><function>PGTYPESnumeric_from_long</function></term>
      <listitem>
       <para>
@@ -2321,7 +2321,7 @@ int PGTYPESnumeric_from_long(signed long int long_val, numeric *var);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-copy">
      <term><function>PGTYPESnumeric_copy</function></term>
      <listitem>
       <para>
@@ -2336,7 +2336,7 @@ int PGTYPESnumeric_copy(numeric *src, numeric *dst);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-from_double">
      <term><function>PGTYPESnumeric_from_double</function></term>
      <listitem>
       <para>
@@ -2351,7 +2351,7 @@ int  PGTYPESnumeric_from_double(double d, numeric *dst);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-to_double">
      <term><function>PGTYPESnumeric_to_double</function></term>
      <listitem>
       <para>
@@ -2368,7 +2368,7 @@ int PGTYPESnumeric_to_double(numeric *nv, double *dp)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-to_int">
      <term><function>PGTYPESnumeric_to_int</function></term>
      <listitem>
       <para>
@@ -2385,7 +2385,7 @@ int PGTYPESnumeric_to_int(numeric *nv, int *ip);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-to_long">
      <term><function>PGTYPESnumeric_to_long</function></term>
      <listitem>
       <para>
@@ -2403,7 +2403,7 @@ int PGTYPESnumeric_to_long(numeric *nv, long *lp);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-to_decimal">
      <term><function>PGTYPESnumeric_to_decimal</function></term>
      <listitem>
       <para>
@@ -2421,7 +2421,7 @@ int PGTYPESnumeric_to_decimal(numeric *src, decimal *dst);
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-pgtypes-numeric-from_decimal">
      <term><function>PGTYPESnumeric_from_decimal</function></term>
      <listitem>
       <para>
@@ -3554,7 +3554,7 @@ int PGTYPESinterval_copy(interval *intvlsrc, interval *intvldest);
     The following functions can be used to work with the decimal type and are
     not only contained in the <literal>libcompat</literal> library.
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-decimal-new">
       <term><function>PGTYPESdecimal_new</function></term>
       <listitem>
        <para>
@@ -3566,7 +3566,7 @@ decimal *PGTYPESdecimal_new(void);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-decimal-free">
       <term><function>PGTYPESdecimal_free</function></term>
       <listitem>
        <para>
@@ -3585,7 +3585,7 @@ void PGTYPESdecimal_free(decimal *var);
     <title>errno Values of pgtypeslib</title>
    <para>
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_num_bad_numeric">
       <term><literal>PGTYPES_NUM_BAD_NUMERIC</literal></term>
       <listitem>
        <para>
@@ -3595,7 +3595,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_num_overflow">
       <term><literal>PGTYPES_NUM_OVERFLOW</literal></term>
       <listitem>
        <para>
@@ -3606,7 +3606,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_num_underflow">
       <term><literal>PGTYPES_NUM_UNDERFLOW</literal></term>
       <listitem>
        <para>
@@ -3617,7 +3617,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_num_divide_zero">
       <term><literal>PGTYPES_NUM_DIVIDE_ZERO</literal></term>
       <listitem>
        <para>
@@ -3626,7 +3626,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_date_bad_date">
       <term><literal>PGTYPES_DATE_BAD_DATE</literal></term>
       <listitem>
        <para>
@@ -3636,7 +3636,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_date_err_eargs">
       <term><literal>PGTYPES_DATE_ERR_EARGS</literal></term>
       <listitem>
        <para>
@@ -3646,7 +3646,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_date_err_enoshortdate">
       <term><literal>PGTYPES_DATE_ERR_ENOSHORTDATE</literal></term>
       <listitem>
        <para>
@@ -3656,7 +3656,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_intvl_bad_interval">
       <term><literal>PGTYPES_INTVL_BAD_INTERVAL</literal></term>
       <listitem>
        <para>
@@ -3668,7 +3668,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_date_err_enotdmy">
       <term><literal>PGTYPES_DATE_ERR_ENOTDMY</literal></term>
       <listitem>
        <para>
@@ -3678,7 +3678,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_date_bad_day">
       <term><literal>PGTYPES_DATE_BAD_DAY</literal></term>
       <listitem>
        <para>
@@ -3688,7 +3688,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_date_bad_month">
       <term><literal>PGTYPES_DATE_BAD_MONTH</literal></term>
       <listitem>
        <para>
@@ -3698,7 +3698,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_ts_bad_timestamp">
       <term><literal>PGTYPES_TS_BAD_TIMESTAMP</literal></term>
       <listitem>
        <para>
@@ -3710,7 +3710,7 @@ void PGTYPESdecimal_free(decimal *var);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-pgtypes-errno-pgtypes_ts_err_einftime">
       <term><literal>PGTYPES_TS_ERR_EINFTIME</literal></term>
       <listitem>
        <para>
@@ -3847,7 +3847,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
     variable containing an integer. Possible fields are:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-cardinality">
       <term><literal>CARDINALITY</literal> (integer)</term>
       <listitem>
        <para>
@@ -3856,7 +3856,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-data">
       <term><literal>DATA</literal></term>
       <listitem>
        <para>
@@ -3866,7 +3866,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-datetime_interval_code">
       <term><literal>DATETIME_INTERVAL_CODE</literal> (integer)</term>
       <listitem>
        <para>
@@ -3881,7 +3881,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-datetime_interval_precision">
       <term><literal>DATETIME_INTERVAL_PRECISION</literal> (integer)</term>
       <listitem>
        <para>
@@ -3890,7 +3890,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-indicator">
       <term><literal>INDICATOR</literal> (integer)</term>
       <listitem>
        <para>
@@ -3899,7 +3899,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-key_member">
       <term><literal>KEY_MEMBER</literal> (integer)</term>
       <listitem>
        <para>
@@ -3908,7 +3908,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-length">
       <term><literal>LENGTH</literal> (integer)</term>
       <listitem>
        <para>
@@ -3917,7 +3917,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-name">
       <term><literal>NAME</literal> (string)</term>
       <listitem>
        <para>
@@ -3926,7 +3926,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-nullable">
       <term><literal>NULLABLE</literal> (integer)</term>
       <listitem>
        <para>
@@ -3935,7 +3935,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-octet_length">
       <term><literal>OCTET_LENGTH</literal> (integer)</term>
       <listitem>
        <para>
@@ -3944,7 +3944,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-precision">
       <term><literal>PRECISION</literal> (integer)</term>
       <listitem>
        <para>
@@ -3953,7 +3953,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-returned_length">
       <term><literal>RETURNED_LENGTH</literal> (integer)</term>
       <listitem>
        <para>
@@ -3962,7 +3962,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-returned_octet_length">
       <term><literal>RETURNED_OCTET_LENGTH</literal> (integer)</term>
       <listitem>
        <para>
@@ -3971,7 +3971,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-scale">
       <term><literal>SCALE</literal> (integer)</term>
       <listitem>
        <para>
@@ -3980,7 +3980,7 @@ EXEC SQL GET DESCRIPTOR <replaceable>name</replaceable> VALUE <replaceable>num</
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-named-descriptors-type">
       <term><literal>TYPE</literal> (integer)</term>
       <listitem>
        <para>
@@ -4059,7 +4059,7 @@ EXEC SQL DESCRIBE prepared_statement INTO mysqlda;
      <step><simpara>Free the memory area allocated for the input SQLDA.</simpara></step>
     </procedure>
 
-   <sect3>
+   <sect3 id="ecpg-sqlda-descriptors-sqlda">
     <title>SQLDA Data Structure</title>
 
     <para>
@@ -4110,7 +4110,7 @@ typedef struct sqlda_struct sqlda_t;
       The meaning of the fields is:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sqlda-sqlda-sqldaid">
       <term><literal>sqldaid</literal></term>
       <listitem>
        <para>
@@ -4119,7 +4119,7 @@ typedef struct sqlda_struct sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sqlda-sqlda-sqldabc">
       <term><literal>sqldabc</literal></term>
       <listitem>
        <para>
@@ -4128,7 +4128,7 @@ typedef struct sqlda_struct sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sqlda-sqlda-sqln">
       <term><literal>sqln</literal></term>
       <listitem>
        <para>
@@ -4143,7 +4143,7 @@ typedef struct sqlda_struct sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sqlda-sqlda-sqld">
       <term><literal>sqld</literal></term>
       <listitem>
        <para>
@@ -4152,7 +4152,7 @@ typedef struct sqlda_struct sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sqlda-sqlda-desc_next">
       <term><literal>desc_next</literal></term>
       <listitem>
        <para>
@@ -4162,7 +4162,7 @@ typedef struct sqlda_struct sqlda_t;
        </para>
       </listitem>
      </varlistentry>
-     <varlistentry>
+     <varlistentry id="ecpg-sqlda-sqlda-sqlvar">
       <term><literal>sqlvar</literal></term>
       <listitem>
        <para>
@@ -4198,7 +4198,7 @@ typedef struct sqlvar_struct sqlvar_t;
       The meaning of the fields is:
 
         <variablelist>
-         <varlistentry>
+         <varlistentry id="ecpg-sqlda-sqlvar-sqltype">
          <term><literal>sqltype</literal></term>
           <listitem>
            <para>
@@ -4208,7 +4208,7 @@ typedef struct sqlvar_struct sqlvar_t;
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="ecpg-sqlda-sqlvar-sqllen">
          <term><literal>sqllen</literal></term>
           <listitem>
            <para>
@@ -4217,7 +4217,7 @@ typedef struct sqlvar_struct sqlvar_t;
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="ecpg-sqlda-sqlvar-sqldata">
          <term><literal>sqldata</literal></term>
           <listitem>
            <para>
@@ -4227,7 +4227,7 @@ typedef struct sqlvar_struct sqlvar_t;
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="ecpg-sqlda-sqlvar-sqlind">
          <term><literal>sqlind</literal></term>
           <listitem>
            <para>
@@ -4237,7 +4237,7 @@ typedef struct sqlvar_struct sqlvar_t;
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="ecpg-sqlda-sqlvar-sqlname">
          <term><literal>sqlname</literal></term>
           <listitem>
            <para>
@@ -4267,7 +4267,7 @@ struct sqlname
 </programlisting>
       The meaning of the fields is:
             <variablelist>
-             <varlistentry>
+             <varlistentry id="ecpg-sqlda-sqlname-length">
               <term><literal>length</literal></term>
                <listitem>
                 <para>
@@ -4275,7 +4275,7 @@ struct sqlname
                 </para>
                </listitem>
               </varlistentry>
-             <varlistentry>
+             <varlistentry id="ecpg-sqlda-sqlname-data">
               <term><literal>data</literal></term>
                <listitem>
                 <para>
@@ -4857,7 +4857,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
     <replaceable>condition</replaceable> can be one of the following:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-sqlerror">
       <term><literal>SQLERROR</literal></term>
       <listitem>
        <para>
@@ -4867,7 +4867,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-sqlwarning">
       <term><literal>SQLWARNING</literal></term>
       <listitem>
        <para>
@@ -4877,7 +4877,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-not-found">
       <term><literal>NOT FOUND</literal></term>
       <listitem>
        <para>
@@ -4894,7 +4894,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
     <replaceable>action</replaceable> can be one of the following:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-continue">
       <term><literal>CONTINUE</literal></term>
       <listitem>
        <para>
@@ -4904,7 +4904,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-goto">
       <term><literal>GOTO <replaceable>label</replaceable></literal></term>
       <term><literal>GO TO <replaceable>label</replaceable></literal></term>
       <listitem>
@@ -4915,7 +4915,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-sqlprint">
       <term><literal>SQLPRINT</literal></term>
       <listitem>
        <para>
@@ -4926,7 +4926,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-stop">
       <term><literal>STOP</literal></term>
       <listitem>
        <para>
@@ -4936,7 +4936,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-do-break">
       <term><literal>DO BREAK</literal></term>
       <listitem>
        <para>
@@ -4946,7 +4946,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-do-continue">
       <term><literal>DO CONTINUE</literal></term>
       <listitem>
        <para>
@@ -4957,7 +4957,7 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-whenever-call">
       <term><literal>CALL <replaceable>name</replaceable> (<replaceable>args</replaceable>)</literal></term>
       <term><literal>DO <replaceable>name</replaceable> (<replaceable>args</replaceable>)</literal></term>
       <listitem>
@@ -5231,7 +5231,7 @@ sqlstate: 42P01
     These are the assigned <literal>SQLCODE</literal> values:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_no_error">
       <term>0 (<symbol>ECPG_NO_ERROR</symbol>)</term>
       <listitem>
        <para>
@@ -5240,7 +5240,7 @@ sqlstate: 42P01
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_not_found">
      <term>100 (<symbol>ECPG_NOT_FOUND</symbol>)</term>
      <listitem>
       <para>
@@ -5267,7 +5267,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_out_of_memory">
       <term>-12 (<symbol>ECPG_OUT_OF_MEMORY</symbol>)</term>
       <listitem>
        <para>
@@ -5278,7 +5278,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_unsupported">
      <term>-200 (<symbol>ECPG_UNSUPPORTED</symbol>)</term>
      <listitem>
       <para>
@@ -5290,7 +5290,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_too_many_arguments">
      <term>-201 (<symbol>ECPG_TOO_MANY_ARGUMENTS</symbol>)</term>
      <listitem>
       <para>
@@ -5300,7 +5300,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_too_few_arguments">
      <term>-202 (<symbol>ECPG_TOO_FEW_ARGUMENTS</symbol>)</term>
      <listitem>
       <para>
@@ -5310,7 +5310,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_too_many_matches">
      <term>-203 (<symbol>ECPG_TOO_MANY_MATCHES</symbol>)</term>
      <listitem>
       <para>
@@ -5321,7 +5321,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_int_format">
      <term>-204 (<symbol>ECPG_INT_FORMAT</symbol>)</term>
      <listitem>
       <para>
@@ -5334,7 +5334,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_uint_format">
      <term>-205 (<symbol>ECPG_UINT_FORMAT</symbol>)</term>
      <listitem>
       <para>
@@ -5347,7 +5347,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_float_format">
      <term>-206 (<symbol>ECPG_FLOAT_FORMAT</symbol>)</term>
      <listitem>
       <para>
@@ -5360,7 +5360,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_numeric_format">
      <term>-207 (<symbol>ECPG_NUMERIC_FORMAT</symbol>)</term>
      <listitem>
       <para>
@@ -5372,7 +5372,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_interval_format">
      <term>-208 (<symbol>ECPG_INTERVAL_FORMAT</symbol>)</term>
      <listitem>
       <para>
@@ -5384,7 +5384,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_date_format">
      <term>-209 (<symbol>ECPG_DATE_FORMAT</symbol>)</term>
      <listitem>
       <para>
@@ -5396,7 +5396,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_timestamp_format">
      <term>-210 (<symbol>ECPG_TIMESTAMP_FORMAT</symbol>)</term>
      <listitem>
       <para>
@@ -5408,7 +5408,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_convert_bool">
      <term>-211 (<symbol>ECPG_CONVERT_BOOL</symbol>)</term>
      <listitem>
       <para>
@@ -5419,7 +5419,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_empty">
      <term>-212 (<symbol>ECPG_EMPTY</symbol>)</term>
      <listitem>
       <para>
@@ -5431,7 +5431,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_missing_indicator">
      <term>-213 (<symbol>ECPG_MISSING_INDICATOR</symbol>)</term>
      <listitem>
       <para>
@@ -5441,7 +5441,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_no_array">
      <term>-214 (<symbol>ECPG_NO_ARRAY</symbol>)</term>
      <listitem>
       <para>
@@ -5451,7 +5451,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_data_not_array">
      <term>-215 (<symbol>ECPG_DATA_NOT_ARRAY</symbol>)</term>
      <listitem>
       <para>
@@ -5461,7 +5461,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_array_insert">
      <term>-216 (<symbol>ECPG_ARRAY_INSERT</symbol>)</term>
      <listitem>
       <para>
@@ -5471,7 +5471,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_no_conn">
      <term>-220 (<symbol>ECPG_NO_CONN</symbol>)</term>
      <listitem>
       <para>
@@ -5481,7 +5481,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_not_conn">
      <term>-221 (<symbol>ECPG_NOT_CONN</symbol>)</term>
      <listitem>
       <para>
@@ -5491,7 +5491,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_invalid_stmt">
      <term>-230 (<symbol>ECPG_INVALID_STMT</symbol>)</term>
      <listitem>
       <para>
@@ -5501,7 +5501,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_informix_duplicate_key">
      <term>-239 (<symbol>ECPG_INFORMIX_DUPLICATE_KEY</symbol>)</term>
      <listitem>
       <para>
@@ -5511,7 +5511,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_unknown_descriptor">
      <term>-240 (<symbol>ECPG_UNKNOWN_DESCRIPTOR</symbol>)</term>
      <listitem>
       <para>
@@ -5521,7 +5521,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_invalid_descriptor_index">
      <term>-241 (<symbol>ECPG_INVALID_DESCRIPTOR_INDEX</symbol>)</term>
      <listitem>
       <para>
@@ -5531,7 +5531,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_unknown_descriptor_item">
      <term>-242 (<symbol>ECPG_UNKNOWN_DESCRIPTOR_ITEM</symbol>)</term>
      <listitem>
       <para>
@@ -5541,7 +5541,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_var_not_numeric">
      <term>-243 (<symbol>ECPG_VAR_NOT_NUMERIC</symbol>)</term>
      <listitem>
       <para>
@@ -5552,7 +5552,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_var_not_char">
      <term>-244 (<symbol>ECPG_VAR_NOT_CHAR</symbol>)</term>
      <listitem>
       <para>
@@ -5563,7 +5563,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_informix_subselect_not_one">
      <term>-284 (<symbol>ECPG_INFORMIX_SUBSELECT_NOT_ONE</symbol>)</term>
      <listitem>
       <para>
@@ -5573,7 +5573,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_pgsql">
      <term>-400 (<symbol>ECPG_PGSQL</symbol>)</term>
      <listitem>
       <para>
@@ -5584,7 +5584,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_trans">
      <term>-401 (<symbol>ECPG_TRANS</symbol>)</term>
      <listitem>
       <para>
@@ -5595,7 +5595,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_connect">
      <term>-402 (<symbol>ECPG_CONNECT</symbol>)</term>
      <listitem>
       <para>
@@ -5605,7 +5605,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_duplicate_key">
      <term>-403 (<symbol>ECPG_DUPLICATE_KEY</symbol>)</term>
      <listitem>
       <para>
@@ -5615,7 +5615,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_subselect_not_one">
      <term>-404 (<symbol>ECPG_SUBSELECT_NOT_ONE</symbol>)</term>
      <listitem>
       <para>
@@ -5626,7 +5626,7 @@ while (1)
 
     <!-- currently not used by the code -->
 <!--
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_warning_unrecognized">
      <term>-600 (<symbol>ECPG_WARNING_UNRECOGNIZED</symbol>)</term>
      <listitem>
       <para>
@@ -5635,7 +5635,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_warning_query_ignored">
      <term>-601 (<symbol>ECPG_WARNING_QUERY_IGNORED</symbol>)</term>
      <listitem>
       <para>
@@ -5646,7 +5646,7 @@ while (1)
     </varlistentry>
 -->
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_warning_unknown_portal">
      <term>-602 (<symbol>ECPG_WARNING_UNKNOWN_PORTAL</symbol>)</term>
      <listitem>
       <para>
@@ -5655,7 +5655,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_warning_in_transaction">
      <term>-603 (<symbol>ECPG_WARNING_IN_TRANSACTION</symbol>)</term>
      <listitem>
       <para>
@@ -5664,7 +5664,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_warning_no_transaction">
      <term>-604 (<symbol>ECPG_WARNING_NO_TRANSACTION</symbol>)</term>
      <listitem>
       <para>
@@ -5673,7 +5673,7 @@ while (1)
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg_warning_portal_exists">
      <term>-605 (<symbol>ECPG_WARNING_PORTAL_EXISTS</symbol>)</term>
      <listitem>
       <para>
@@ -5804,7 +5804,7 @@ EXEC SQL UPDATE Tbl SET col = MYNUMBER;
    You can use the following directives to compile code sections conditionally:
 
    <variablelist>
-    <varlistentry>
+    <varlistentry id="ecpg-ifdef-ifdef">
      <term><literal>EXEC SQL ifdef <replaceable>name</replaceable>;</literal></term>
      <listitem>
      <para>
@@ -5815,7 +5815,7 @@ EXEC SQL UPDATE Tbl SET col = MYNUMBER;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-ifdef-ifndef">
      <term><literal>EXEC SQL ifndef <replaceable>name</replaceable>;</literal></term>
      <listitem>
      <para>
@@ -5826,7 +5826,7 @@ EXEC SQL UPDATE Tbl SET col = MYNUMBER;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-ifdef-elif">
      <term><literal>EXEC SQL elif <replaceable>name</replaceable>;</literal></term>
      <listitem>
      <para>
@@ -5843,7 +5843,7 @@ EXEC SQL UPDATE Tbl SET col = MYNUMBER;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-ifdef-else">
      <term><literal>EXEC SQL else;</literal></term>
      <listitem>
      <para>
@@ -5858,7 +5858,7 @@ EXEC SQL UPDATE Tbl SET col = MYNUMBER;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ecpg-ifdef-endif">
      <term><literal>EXEC SQL endif;</literal></term>
      <listitem>
      <para>
@@ -6305,7 +6305,7 @@ void TestCpp::test()
     (<filename>*.pgc</filename>), a header file, and a C++ file:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-cpp-and-c-test_mod_pgc">
       <term><filename>test_mod.pgc</filename></term>
       <listitem>
        <para>
@@ -6345,7 +6345,7 @@ db_disconnect()
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-cpp-and-c-test_mod_h">
       <term><filename>test_mod.h</filename></term>
       <listitem>
        <para>
@@ -6372,7 +6372,7 @@ void db_disconnect();
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-cpp-and-c-test_cpp_cpp">
       <term><filename>test_cpp.cpp</filename></term>
       <listitem>
        <para>
@@ -6494,7 +6494,7 @@ ALLOCATE DESCRIPTOR <replaceable class="parameter">name</replaceable>
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-allocate-descriptor-name">
       <term><replaceable class="parameter">name</replaceable></term>
       <listitem>
        <para>
@@ -6562,7 +6562,7 @@ DATABASE <replaceable>connection_target</replaceable>
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-connect-connection_target">
       <term><replaceable class="parameter">connection_target</replaceable></term>
       <listitem>
        <para>
@@ -6571,7 +6571,7 @@ DATABASE <replaceable>connection_target</replaceable>
         several forms.
 
         <variablelist>
-         <varlistentry>
+         <varlistentry id="ecpg-sql-connect-connection_target-database_name">
           <term>[ <replaceable>database_name</replaceable> ] [ <literal>@</literal><replaceable>host</replaceable> ] [ <literal>:</literal><replaceable>port</replaceable> ]</term>
           <listitem>
            <para>
@@ -6580,7 +6580,7 @@ DATABASE <replaceable>connection_target</replaceable>
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="ecpg-sql-connect-connection_target-unix-domain-sockets">
           <term><literal>unix:postgresql://</literal><replaceable>host</replaceable> [ <literal>:</literal><replaceable>port</replaceable> ] <literal>/</literal> [ <replaceable>database_name</replaceable> ] [ <literal>?</literal><replaceable>connection_option</replaceable> ]</term>
           <listitem>
            <para>
@@ -6589,7 +6589,7 @@ DATABASE <replaceable>connection_target</replaceable>
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="ecpg-sql-connect-connection_target-tcp-ip">
           <term><literal>tcp:postgresql://</literal><replaceable>host</replaceable> [ <literal>:</literal><replaceable>port</replaceable> ] <literal>/</literal> [ <replaceable>database_name</replaceable> ] [ <literal>?</literal><replaceable>connection_option</replaceable> ]</term>
           <listitem>
            <para>
@@ -6598,7 +6598,7 @@ DATABASE <replaceable>connection_target</replaceable>
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="ecpg-sql-connect-connection_target-constant">
           <term>SQL string constant</term>
           <listitem>
            <para>
@@ -6607,7 +6607,7 @@ DATABASE <replaceable>connection_target</replaceable>
           </listitem>
          </varlistentry>
 
-         <varlistentry>
+         <varlistentry id="ecpg-sql-connect-connection_target-host-variable">
           <term>host variable</term>
           <listitem>
            <para>
@@ -6622,7 +6622,7 @@ DATABASE <replaceable>connection_target</replaceable>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-connect-connection_name">
       <term><replaceable class="parameter">connection_name</replaceable></term>
       <listitem>
        <para>
@@ -6633,7 +6633,7 @@ DATABASE <replaceable>connection_target</replaceable>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-connect-connection_user">
       <term><replaceable class="parameter">connection_user</replaceable></term>
       <listitem>
        <para>
@@ -6654,7 +6654,7 @@ DATABASE <replaceable>connection_target</replaceable>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-connect-default">
       <term><literal>DEFAULT</literal></term>
       <listitem>
        <para>
@@ -6779,7 +6779,7 @@ DEALLOCATE DESCRIPTOR <replaceable class="parameter">name</replaceable>
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-deallocate-descriptor-name">
       <term><replaceable class="parameter">name</replaceable></term>
       <listitem>
        <para>
@@ -6853,7 +6853,7 @@ DECLARE <replaceable class="parameter">cursor_name</replaceable> [ BINARY ] [ AS
     <title>Parameters</title>
     <variablelist>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-declare-cursor_name">
       <term><replaceable class="parameter">cursor_name</replaceable></term>
       <listitem>
        <para>
@@ -6863,7 +6863,7 @@ DECLARE <replaceable class="parameter">cursor_name</replaceable> [ BINARY ] [ AS
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-declare-prepared_name">
       <term><replaceable class="parameter">prepared_name</replaceable></term>
       <listitem>
        <para>
@@ -6873,7 +6873,7 @@ DECLARE <replaceable class="parameter">cursor_name</replaceable> [ BINARY ] [ AS
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-declare-query">
       <term><replaceable class="parameter">query</replaceable></term>
       <listitem>
        <para>
@@ -6963,7 +6963,7 @@ EXEC SQL [ AT <replaceable class="parameter">connection_name</replaceable> ] DEC
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-declare-statement-connection_name">
       <term><replaceable class="parameter">connection_name</replaceable></term>
       <listitem>
        <para>
@@ -6977,7 +6977,7 @@ EXEC SQL [ AT <replaceable class="parameter">connection_name</replaceable> ] DEC
     </variablelist>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-declare-statement-statement_name">
       <term><replaceable class="parameter">statement_name</replaceable></term>
       <listitem>
        <para>
@@ -7057,7 +7057,7 @@ DESCRIBE [ OUTPUT ] <replaceable class="parameter">prepared_name</replaceable> I
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-describe-prepared_name">
       <term><replaceable class="parameter">prepared_name</replaceable></term>
       <listitem>
        <para>
@@ -7067,7 +7067,7 @@ DESCRIBE [ OUTPUT ] <replaceable class="parameter">prepared_name</replaceable> I
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-describe-descriptor_name">
       <term><replaceable class="parameter">descriptor_name</replaceable></term>
       <listitem>
        <para>
@@ -7077,7 +7077,7 @@ DESCRIBE [ OUTPUT ] <replaceable class="parameter">prepared_name</replaceable> I
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-describe-sqlda_name">
       <term><replaceable class="parameter">sqlda_name</replaceable></term>
       <listitem>
        <para>
@@ -7146,7 +7146,7 @@ DISCONNECT ALL
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-disconnect-connection_name">
       <term><replaceable class="parameter">connection_name</replaceable></term>
       <listitem>
        <para>
@@ -7156,7 +7156,7 @@ DISCONNECT ALL
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-disconnect-current">
       <term><literal>CURRENT</literal></term>
       <listitem>
        <para>
@@ -7169,7 +7169,7 @@ DISCONNECT ALL
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-disconnect-default">
       <term><literal>DEFAULT</literal></term>
       <listitem>
        <para>
@@ -7178,7 +7178,7 @@ DISCONNECT ALL
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-disconnect-all">
       <term><literal>ALL</literal></term>
       <listitem>
        <para>
@@ -7254,7 +7254,7 @@ EXECUTE IMMEDIATE <replaceable class="parameter">string</replaceable>
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-execute-immediate-string">
       <term><replaceable class="parameter">string</replaceable></term>
       <listitem>
        <para>
@@ -7352,7 +7352,7 @@ GET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-get-descriptor-descriptor_name">
       <term><replaceable class="parameter">descriptor_name</replaceable></term>
       <listitem>
        <para>
@@ -7361,7 +7361,7 @@ GET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-get-descriptor-descriptor_header_item">
       <term><replaceable class="parameter">descriptor_header_item</replaceable></term>
       <listitem>
        <para>
@@ -7372,7 +7372,7 @@ GET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-get-descriptor-column_number">
       <term><replaceable class="parameter">column_number</replaceable></term>
       <listitem>
        <para>
@@ -7382,7 +7382,7 @@ GET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-get-descriptor-descriptor_item">
       <term><replaceable class="parameter">descriptor_item</replaceable></term>
       <listitem>
        <para>
@@ -7393,7 +7393,7 @@ GET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-get-descriptor-cvariable">
       <term><replaceable class="parameter">cvariable</replaceable></term>
       <listitem>
        <para>
@@ -7533,7 +7533,7 @@ OPEN <replaceable class="parameter">cursor_name</replaceable> USING SQL DESCRIPT
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-open-cursor_name">
       <term><replaceable class="parameter">cursor_name</replaceable></term>
       <listitem>
        <para>
@@ -7543,7 +7543,7 @@ OPEN <replaceable class="parameter">cursor_name</replaceable> USING SQL DESCRIPT
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-open-value">
       <term><replaceable class="parameter">value</replaceable></term>
       <listitem>
        <para>
@@ -7554,7 +7554,7 @@ OPEN <replaceable class="parameter">cursor_name</replaceable> USING SQL DESCRIPT
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-open-descriptor_name">
       <term><replaceable class="parameter">descriptor_name</replaceable></term>
       <listitem>
        <para>
@@ -7624,7 +7624,7 @@ PREPARE <replaceable class="parameter">prepared_name</replaceable> FROM <replace
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-prepare-prepared_name">
       <term><replaceable class="parameter">prepared_name</replaceable></term>
       <listitem>
        <para>
@@ -7633,7 +7633,7 @@ PREPARE <replaceable class="parameter">prepared_name</replaceable> FROM <replace
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-prepare-string">
       <term><replaceable class="parameter">string</replaceable></term>
       <listitem>
        <para>
@@ -7760,7 +7760,7 @@ SET CONNECTION [ TO | = ] <replaceable class="parameter">connection_name</replac
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-set-connection-connection_name">
       <term><replaceable class="parameter">connection_name</replaceable></term>
       <listitem>
        <para>
@@ -7770,7 +7770,7 @@ SET CONNECTION [ TO | = ] <replaceable class="parameter">connection_name</replac
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-set-connection-default">
       <term><literal>DEFAULT</literal></term>
       <listitem>
        <para>
@@ -7842,7 +7842,7 @@ SET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-set-descriptor-descriptor_name">
       <term><replaceable class="parameter">descriptor_name</replaceable></term>
       <listitem>
        <para>
@@ -7851,7 +7851,7 @@ SET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-set-descriptor-descriptor_header_item">
       <term><replaceable class="parameter">descriptor_header_item</replaceable></term>
       <listitem>
        <para>
@@ -7862,7 +7862,7 @@ SET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-set-descriptor-number">
       <term><replaceable class="parameter">number</replaceable></term>
       <listitem>
        <para>
@@ -7872,7 +7872,7 @@ SET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-set-descriptor-descriptor_item">
       <term><replaceable class="parameter">descriptor_item</replaceable></term>
       <listitem>
        <para>
@@ -7883,7 +7883,7 @@ SET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALU
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-set-descriptor-value">
       <term><replaceable class="parameter">value</replaceable></term>
       <listitem>
        <para>
@@ -7955,7 +7955,7 @@ TYPE <replaceable class="parameter">type_name</replaceable> IS <replaceable clas
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-type-type_name">
       <term><replaceable class="parameter">type_name</replaceable></term>
       <listitem>
        <para>
@@ -7964,7 +7964,7 @@ TYPE <replaceable class="parameter">type_name</replaceable> IS <replaceable clas
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-type-ctype">
       <term><replaceable class="parameter">ctype</replaceable></term>
       <listitem>
        <para>
@@ -8089,7 +8089,7 @@ VAR <replaceable>varname</replaceable> IS <replaceable>ctype</replaceable>
     <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-sql-var-varname">
       <term><replaceable class="parameter">varname</replaceable></term>
       <listitem>
        <para>
@@ -8098,7 +8098,7 @@ VAR <replaceable>varname</replaceable> IS <replaceable>ctype</replaceable>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-sql-var-ctype">
       <term><replaceable class="parameter">ctype</replaceable></term>
       <listitem>
        <para>
@@ -8296,7 +8296,7 @@ EXEC SQL FETCH MYCUR INTO :userid;
    <title>Additional/Missing Embedded SQL Statements</title>
    <para>
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-informix-statements-close-database">
       <term><literal>CLOSE DATABASE</literal></term>
       <listitem>
        <para>
@@ -8309,7 +8309,7 @@ EXEC SQL CLOSE DATABASE;
        </para>
       </listitem>
      </varlistentry>
-     <varlistentry>
+     <varlistentry id="ecpg-informix-statements-free-cursor_name">
       <term><literal>FREE cursor_name</literal></term>
       <listitem>
        <para>
@@ -8322,7 +8322,7 @@ EXEC SQL CLOSE DATABASE;
        </para>
       </listitem>
      </varlistentry>
-     <varlistentry>
+     <varlistentry id="ecpg-informix-statements-free-statement_name">
       <term><literal>FREE statement_name</literal></term>
       <listitem>
        <para>
@@ -8382,7 +8382,7 @@ typedef struct sqlda_compat     sqlda_t;
     The global properties are:
     <variablelist>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqld">
      <term><literal>sqld</literal></term>
       <listitem>
        <para>
@@ -8391,7 +8391,7 @@ typedef struct sqlda_compat     sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqlvar">
      <term><literal>sqlvar</literal></term>
       <listitem>
        <para>
@@ -8400,7 +8400,7 @@ typedef struct sqlda_compat     sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-desc_name">
      <term><literal>desc_name</literal></term>
       <listitem>
        <para>
@@ -8409,7 +8409,7 @@ typedef struct sqlda_compat     sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-desc_occ">
      <term><literal>desc_occ</literal></term>
       <listitem>
        <para>
@@ -8418,7 +8418,7 @@ typedef struct sqlda_compat     sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-desc_next">
      <term><literal>desc_next</literal></term>
       <listitem>
        <para>
@@ -8427,7 +8427,7 @@ typedef struct sqlda_compat     sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-reserved">
      <term><literal>reserved</literal></term>
       <listitem>
        <para>
@@ -8442,7 +8442,7 @@ typedef struct sqlda_compat     sqlda_t;
 
     <variablelist>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqltype">
      <term><literal>sqltype</literal></term>
       <listitem>
        <para>
@@ -8451,7 +8451,7 @@ typedef struct sqlda_compat     sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqllen">
      <term><literal>sqllen</literal></term>
       <listitem>
        <para>
@@ -8460,7 +8460,7 @@ typedef struct sqlda_compat     sqlda_t;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqldata">
      <term><literal>sqldata</literal></term>
       <listitem>
        <para>
@@ -8481,7 +8481,7 @@ switch (sqldata->sqlvar[i].sqltype)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqlind">
      <term><literal>sqlind</literal></term>
       <listitem>
        <para>
@@ -8497,7 +8497,7 @@ if (*(int2 *)sqldata->sqlvar[i].sqlind != 0)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqlname">
      <term><literal>sqlname</literal></term>
       <listitem>
        <para>
@@ -8506,7 +8506,7 @@ if (*(int2 *)sqldata->sqlvar[i].sqlind != 0)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqlformat">
      <term><literal>sqlformat</literal></term>
       <listitem>
        <para>
@@ -8515,7 +8515,7 @@ if (*(int2 *)sqldata->sqlvar[i].sqlind != 0)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqlitype">
      <term><literal>sqlitype</literal></term>
       <listitem>
        <para>
@@ -8526,7 +8526,7 @@ if (*(int2 *)sqldata->sqlvar[i].sqlind != 0)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqlilen">
      <term><literal>sqlilen</literal></term>
       <listitem>
        <para>
@@ -8535,7 +8535,7 @@ if (*(int2 *)sqldata->sqlvar[i].sqlind != 0)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqlxid">
      <term><literal>sqlxid</literal></term>
       <listitem>
        <para>
@@ -8544,7 +8544,7 @@ if (*(int2 *)sqldata->sqlvar[i].sqlind != 0)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqltypename-et-al">
      <term><literal>sqltypename</literal></term>
      <term><literal>sqltypelen</literal></term>
      <term><literal>sqlownerlen</literal></term>
@@ -8560,7 +8560,7 @@ if (*(int2 *)sqldata->sqlvar[i].sqlind != 0)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-sqlda-sqlilongdata">
      <term><literal>sqlilongdata</literal></term>
       <listitem>
        <para>
@@ -8615,7 +8615,7 @@ EXEC SQL INCLUDE sqlda.h;
    <title>Additional Functions</title>
    <para>
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-decadd">
       <term><function>decadd</function></term>
       <listitem>
        <para>
@@ -8635,7 +8635,7 @@ int decadd(decimal *arg1, decimal *arg2, decimal *sum);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-deccmp">
       <term><function>deccmp</function></term>
       <listitem>
        <para>
@@ -8670,7 +8670,7 @@ int deccmp(decimal *arg1, decimal *arg2);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-deccopy">
       <term><function>deccopy</function></term>
       <listitem>
        <para>
@@ -8686,7 +8686,7 @@ void deccopy(decimal *src, decimal *target);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-deccvasc">
       <term><function>deccvasc</function></term>
       <listitem>
        <para>
@@ -8719,7 +8719,7 @@ int deccvasc(char *cp, int len, decimal *np);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-deccvdbl">
       <term><function>deccvdbl</function></term>
       <listitem>
        <para>
@@ -8739,7 +8739,7 @@ int deccvdbl(double dbl, decimal *np);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-deccvint">
       <term><function>deccvint</function></term>
       <listitem>
        <para>
@@ -8759,7 +8759,7 @@ int deccvint(int in, decimal *np);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-deccvlong">
       <term><function>deccvlong</function></term>
       <listitem>
        <para>
@@ -8779,7 +8779,7 @@ int deccvlong(long lng, decimal *np);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-decdiv">
       <term><function>decdiv</function></term>
       <listitem>
        <para>
@@ -8803,7 +8803,7 @@ int decdiv(decimal *n1, decimal *n2, decimal *result);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-decmul">
       <term><function>decmul</function></term>
       <listitem>
        <para>
@@ -8825,7 +8825,7 @@ int decmul(decimal *n1, decimal *n2, decimal *result);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-decsub">
       <term><function>decsub</function></term>
       <listitem>
        <para>
@@ -8847,7 +8847,7 @@ int decsub(decimal *n1, decimal *n2, decimal *result);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dectoasc">
       <term><function>dectoasc</function></term>
       <listitem>
        <para>
@@ -8877,7 +8877,7 @@ int dectoasc(decimal *np, char *cp, int len, int right)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dectodbl">
       <term><function>dectodbl</function></term>
       <listitem>
        <para>
@@ -8896,7 +8896,7 @@ int dectodbl(decimal *np, double *dblp);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dectoint">
       <term><function>dectoint</function></term>
       <listitem>
        <para>
@@ -8922,7 +8922,7 @@ int dectoint(decimal *np, int *ip);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dectolong">
       <term><function>dectolong</function></term>
       <listitem>
        <para>
@@ -8949,7 +8949,7 @@ int dectolong(decimal *np, long *lngp);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rdatestr">
       <term><function>rdatestr</function></term>
       <listitem>
        <para>
@@ -8976,7 +8976,7 @@ int rdatestr(date d, char *str);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rstrdate">
       <term><function>rstrdate</function></term>
       <listitem>
        <para>
@@ -9000,7 +9000,7 @@ int rstrdate(char *str, date *d);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rtoday">
       <term><function>rtoday</function></term>
       <listitem>
        <para>
@@ -9018,7 +9018,7 @@ void rtoday(date *d);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rjulmdy">
       <term><function>rjulmdy</function></term>
       <listitem>
        <para>
@@ -9043,7 +9043,7 @@ int rjulmdy(date d, short mdy[3]);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rdefmtdate">
       <term><function>rdefmtdate</function></term>
       <listitem>
        <para>
@@ -9113,7 +9113,7 @@ int rdefmtdate(date *d, char *fmt, char *str);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rfmtdate">
       <term><function>rfmtdate</function></term>
       <listitem>
        <para>
@@ -9136,7 +9136,7 @@ int rfmtdate(date d, char *fmt, char *str);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rmdyjul">
       <term><function>rmdyjul</function></term>
       <listitem>
        <para>
@@ -9159,7 +9159,7 @@ int rmdyjul(short mdy[3], date *d);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rdayofweek">
       <term><function>rdayofweek</function></term>
       <listitem>
        <para>
@@ -9215,7 +9215,7 @@ int rdayofweek(date d);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dtcurrent">
       <term><function>dtcurrent</function></term>
       <listitem>
        <para>
@@ -9229,7 +9229,7 @@ void dtcurrent(timestamp *ts);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dtcvasc">
       <term><function>dtcvasc</function></term>
       <listitem>
        <para>
@@ -9254,7 +9254,7 @@ int dtcvasc(char *str, timestamp *ts);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dtcvfmtasc">
       <term><function>dtcvfmtasc</function></term>
       <listitem>
        <para>
@@ -9280,7 +9280,7 @@ dtcvfmtasc(char *inbuf, char *fmtstr, timestamp *dtvalue)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dtsub">
       <term><function>dtsub</function></term>
       <listitem>
        <para>
@@ -9301,7 +9301,7 @@ int dtsub(timestamp *ts1, timestamp *ts2, interval *iv);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dttoasc">
       <term><function>dttoasc</function></term>
       <listitem>
        <para>
@@ -9322,7 +9322,7 @@ int dttoasc(timestamp *ts, char *output);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-dttofmtasc">
       <term><function>dttofmtasc</function></term>
       <listitem>
        <para>
@@ -9348,7 +9348,7 @@ int dttofmtasc(timestamp *ts, char *output, int str_len, char *fmtstr);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-intoasc">
       <term><function>intoasc</function></term>
       <listitem>
        <para>
@@ -9369,7 +9369,7 @@ int intoasc(interval *i, char *str);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rfmtlong">
       <term><function>rfmtlong</function></term>
       <listitem>
        <para>
@@ -9455,7 +9455,7 @@ int rfmtlong(long lng_val, char *fmt, char *outbuf);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rupshift">
       <term><function>rupshift</function></term>
       <listitem>
        <para>
@@ -9469,7 +9469,7 @@ void rupshift(char *str);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-byleng">
       <term><function>byleng</function></term>
       <listitem>
        <para>
@@ -9486,7 +9486,7 @@ int byleng(char *str, int len);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-ldchar">
       <term><function>ldchar</function></term>
       <listitem>
        <para>
@@ -9505,7 +9505,7 @@ void ldchar(char *src, int len, char *dest);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rgetmsg">
       <term><function>rgetmsg</function></term>
       <listitem>
        <para>
@@ -9517,7 +9517,7 @@ int rgetmsg(int msgnum, char *s, int maxsize);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rtypalign">
       <term><function>rtypalign</function></term>
       <listitem>
        <para>
@@ -9529,7 +9529,7 @@ int rtypalign(int offset, int type);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rtypmsize">
       <term><function>rtypmsize</function></term>
       <listitem>
        <para>
@@ -9541,7 +9541,7 @@ int rtypmsize(int type, int len);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-rtypwidth">
       <term><function>rtypwidth</function></term>
       <listitem>
        <para>
@@ -9637,7 +9637,7 @@ rsetnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-functions-risnull">
       <term><function>risnull</function></term>
       <listitem>
        <para>
@@ -9679,7 +9679,7 @@ risnull(CINTTYPE, (char *) &i);
     however rely on the fact all of them are defined to represent negative
     values.
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_num_overflow">
       <term><literal>ECPG_INFORMIX_NUM_OVERFLOW</literal></term>
       <listitem>
        <para>
@@ -9690,7 +9690,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_num_underflow">
       <term><literal>ECPG_INFORMIX_NUM_UNDERFLOW</literal></term>
       <listitem>
        <para>
@@ -9700,7 +9700,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_divide_zero">
       <term><literal>ECPG_INFORMIX_DIVIDE_ZERO</literal></term>
       <listitem>
        <para>
@@ -9710,7 +9710,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_bad_year">
       <term><literal>ECPG_INFORMIX_BAD_YEAR</literal></term>
       <listitem>
        <para>
@@ -9721,7 +9721,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_bad_month">
       <term><literal>ECPG_INFORMIX_BAD_MONTH</literal></term>
       <listitem>
        <para>
@@ -9732,7 +9732,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_bad_day">
       <term><literal>ECPG_INFORMIX_BAD_DAY</literal></term>
       <listitem>
        <para>
@@ -9743,7 +9743,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_enoshortdate">
       <term><literal>ECPG_INFORMIX_ENOSHORTDATE</literal></term>
       <listitem>
        <para>
@@ -9754,7 +9754,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_date_convert">
       <term><literal>ECPG_INFORMIX_DATE_CONVERT</literal></term>
       <listitem>
        <para>
@@ -9765,7 +9765,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_out_of_memory">
       <term><literal>ECPG_INFORMIX_OUT_OF_MEMORY</literal></term>
       <listitem>
        <para>
@@ -9776,7 +9776,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_enotdmy">
       <term><literal>ECPG_INFORMIX_ENOTDMY</literal></term>
       <listitem>
        <para>
@@ -9787,7 +9787,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_bad_numeric">
       <term><literal>ECPG_INFORMIX_BAD_NUMERIC</literal></term>
       <listitem>
        <para>
@@ -9800,7 +9800,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_bad_exponent">
       <term><literal>ECPG_INFORMIX_BAD_EXPONENT</literal></term>
       <listitem>
        <para>
@@ -9811,7 +9811,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_bad_date">
       <term><literal>ECPG_INFORMIX_BAD_DATE</literal></term>
       <listitem>
        <para>
@@ -9822,7 +9822,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-informix-constants-ecpg_informix_extra_chars">
       <term><literal>ECPG_INFORMIX_EXTRA_CHARS</literal></term>
       <listitem>
        <para>
@@ -9917,7 +9917,7 @@ risnull(CINTTYPE, (char *) &i);
     The arguments are:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="ecpg-develop-line-number">
       <term>A line number</term>
       <listitem>
        <para>
@@ -9927,7 +9927,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-develop-string">
       <term>A string</term>
       <listitem>
        <para>
@@ -9940,7 +9940,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-develop-input-variables">
       <term>Input variables</term>
       <listitem>
        <para>
@@ -9949,7 +9949,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-develop-ecpgt_eoit">
       <term><parameter>ECPGt_EOIT</parameter></term>
       <listitem>
        <para>
@@ -9959,7 +9959,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="ecpg-develop-output-variables">
       <term>Output variables</term>
       <listitem>
        <para>
@@ -9969,7 +9969,7 @@ risnull(CINTTYPE, (char *) &i);
       </listitem>
      </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="ecpg-develop-ecpgt_eort">
        <term><parameter>ECPGt_EORT</parameter></term>
        <listitem>
        <para>
diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml
index 46e873a166..306a5b1a59 100644
--- a/doc/src/sgml/extend.sgml
+++ b/doc/src/sgml/extend.sgml
@@ -120,7 +120,7 @@
     types, container types, domains, and pseudo-types.
    </para>
 
-   <sect2>
+   <sect2 id="extend-type-system-base">
     <title>Base Types</title>
 
     <para>
@@ -143,7 +143,7 @@
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="extend-type-system-container">
     <title>Container Types</title>
 
     <para>
@@ -193,7 +193,7 @@
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="extend-type-system-pseudo">
     <title>Pseudo-Types</title>
 
     <para>
@@ -628,7 +628,7 @@ RETURNS anycompatible AS ...
     dropping the whole extension.
    </para>
 
-   <sect2>
+   <sect2 id="extend-extensions-files">
     <title>Extension Files</title>
 
    <indexterm>
@@ -663,7 +663,7 @@ RETURNS anycompatible AS ...
     </para>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-directory">
       <term><varname>directory</varname> (<type>string</type>)</term>
       <listitem>
        <para>
@@ -676,7 +676,7 @@ RETURNS anycompatible AS ...
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-default_version">
       <term><varname>default_version</varname> (<type>string</type>)</term>
       <listitem>
        <para>
@@ -689,7 +689,7 @@ RETURNS anycompatible AS ...
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-comment">
       <term><varname>comment</varname> (<type>string</type>)</term>
       <listitem>
        <para>
@@ -702,7 +702,7 @@ RETURNS anycompatible AS ...
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-encoding">
       <term><varname>encoding</varname> (<type>string</type>)</term>
       <listitem>
        <para>
@@ -713,7 +713,7 @@ RETURNS anycompatible AS ...
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-module_pathname">
       <term><varname>module_pathname</varname> (<type>string</type>)</term>
       <listitem>
        <para>
@@ -728,7 +728,7 @@ RETURNS anycompatible AS ...
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-requires">
       <term><varname>requires</varname> (<type>string</type>)</term>
       <listitem>
        <para>
@@ -739,7 +739,7 @@ RETURNS anycompatible AS ...
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-superuser">
       <term><varname>superuser</varname> (<type>boolean</type>)</term>
       <listitem>
        <para>
@@ -756,7 +756,7 @@ RETURNS anycompatible AS ...
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-trusted">
       <term><varname>trusted</varname> (<type>boolean</type>)</term>
       <listitem>
        <para>
@@ -781,7 +781,7 @@ RETURNS anycompatible AS ...
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-relocatable">
       <term><varname>relocatable</varname> (<type>boolean</type>)</term>
       <listitem>
        <para>
@@ -794,7 +794,7 @@ RETURNS anycompatible AS ...
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-extensions-files-schema">
       <term><varname>schema</varname> (<type>string</type>)</term>
       <listitem>
        <para>
@@ -1063,7 +1063,7 @@ SELECT pg_catalog.pg_extension_config_dump('my_config', 'WHERE NOT standard_entr
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="extend-extensions-updates">
     <title>Extension Updates</title>
 
     <para>
@@ -1144,7 +1144,7 @@ SELECT * FROM pg_extension_update_paths('<replaceable>extension_name</replaceabl
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="extend-extensions-update-scripts">
     <title>Installing Extensions Using Update Scripts</title>
 
     <para>
@@ -1453,7 +1453,7 @@ include $(PGXS)
     Set one of these three variables to specify what is built:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="extend-pgxs-modules">
       <term><varname>MODULES</varname></term>
       <listitem>
        <para>
@@ -1463,7 +1463,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-module_big">
       <term><varname>MODULE_big</varname></term>
       <listitem>
        <para>
@@ -1473,7 +1473,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-program">
       <term><varname>PROGRAM</varname></term>
       <listitem>
        <para>
@@ -1487,7 +1487,7 @@ include $(PGXS)
     The following variables can also be set:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="extend-pgxs-extension">
       <term><varname>EXTENSION</varname></term>
       <listitem>
        <para>
@@ -1499,7 +1499,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-moduledir">
       <term><varname>MODULEDIR</varname></term>
       <listitem>
        <para>
@@ -1512,7 +1512,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-data">
       <term><varname>DATA</varname></term>
       <listitem>
        <para>
@@ -1521,7 +1521,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-data_built">
       <term><varname>DATA_built</varname></term>
       <listitem>
        <para>
@@ -1532,7 +1532,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-data_tsearch">
       <term><varname>DATA_TSEARCH</varname></term>
       <listitem>
        <para>
@@ -1542,7 +1542,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-docs">
       <term><varname>DOCS</varname></term>
       <listitem>
        <para>
@@ -1552,7 +1552,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-headers">
       <term><varname>HEADERS</varname></term>
       <term><varname>HEADERS_built</varname></term>
       <listitem>
@@ -1568,7 +1568,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-headers_module">
       <term><varname>HEADERS_$MODULE</varname></term>
       <term><varname>HEADERS_built_$MODULE</varname></term>
       <listitem>
@@ -1594,7 +1594,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-scripts">
       <term><varname>SCRIPTS</varname></term>
       <listitem>
        <para>
@@ -1604,7 +1604,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-scripts_built">
       <term><varname>SCRIPTS_built</varname></term>
       <listitem>
        <para>
@@ -1615,7 +1615,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-regress">
       <term><varname>REGRESS</varname></term>
       <listitem>
        <para>
@@ -1624,7 +1624,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-regress_opts">
       <term><varname>REGRESS_OPTS</varname></term>
       <listitem>
        <para>
@@ -1633,7 +1633,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-isolation">
       <term><varname>ISOLATION</varname></term>
       <listitem>
        <para>
@@ -1642,7 +1642,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-isolation_opts">
       <term><varname>ISOLATION_OPTS</varname></term>
       <listitem>
        <para>
@@ -1652,7 +1652,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-tap_tests">
       <term><varname>TAP_TESTS</varname></term>
       <listitem>
        <para>
@@ -1661,7 +1661,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-no_install">
       <term><varname>NO_INSTALL</varname></term>
       <listitem>
        <para>
@@ -1671,7 +1671,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-no_installcheck">
       <term><varname>NO_INSTALLCHECK</varname></term>
       <listitem>
        <para>
@@ -1680,7 +1680,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-extra_clean">
       <term><varname>EXTRA_CLEAN</varname></term>
       <listitem>
        <para>
@@ -1689,7 +1689,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-pg_cppflags">
       <term><varname>PG_CPPFLAGS</varname></term>
       <listitem>
        <para>
@@ -1698,7 +1698,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-pg_cflags">
       <term><varname>PG_CFLAGS</varname></term>
       <listitem>
        <para>
@@ -1707,7 +1707,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-pg_cxxflags">
       <term><varname>PG_CXXFLAGS</varname></term>
       <listitem>
        <para>
@@ -1716,7 +1716,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-pg_ldflags">
       <term><varname>PG_LDFLAGS</varname></term>
       <listitem>
        <para>
@@ -1725,7 +1725,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-pg_libs">
       <term><varname>PG_LIBS</varname></term>
       <listitem>
        <para>
@@ -1734,7 +1734,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-shlib_link">
       <term><varname>SHLIB_LINK</varname></term>
       <listitem>
        <para>
@@ -1743,7 +1743,7 @@ include $(PGXS)
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="extend-pgxs-pg_config">
       <term><varname>PG_CONFIG</varname></term>
       <listitem>
        <para>
diff --git a/doc/src/sgml/features.sgml b/doc/src/sgml/features.sgml
index 05365d890b..afbea9d982 100644
--- a/doc/src/sgml/features.sgml
+++ b/doc/src/sgml/features.sgml
@@ -238,7 +238,7 @@
      <productname>PostgreSQL</productname>-specific functions.
     </para>
 
-    <sect3>
+    <sect3 id="functions-xml-limits-xpath1-xquery-restriction">
      <title>Restriction of XQuery to XPath</title>
 
      <para>
@@ -427,7 +427,7 @@
      implementation in <productname>PostgreSQL</productname>.
     </para>
 
-    <sect3>
+    <sect3 id="functions-xml-limits-postgresql-by-value-only">
      <title>Only <literal>BY VALUE</literal> Passing Mechanism Is Supported</title>
 
      <para>
@@ -463,7 +463,7 @@ SELECT XMLQUERY('$a is $b' PASSING BY VALUE <replaceable>x</replaceable> AS a, <
      </para>
     </sect3>
 
-    <sect3>
+    <sect3 id="functions-xml-limits-postgresql-named-parameters">
      <title>Cannot Pass Named Parameters to Queries</title>
 
      <para>
@@ -473,7 +473,7 @@ SELECT XMLQUERY('$a is $b' PASSING BY VALUE <replaceable>x</replaceable> AS a, <
      </para>
     </sect3>
 
-    <sect3>
+    <sect3 id="functions-xml-limits-postgresql-no-xml-sequence">
      <title>No <type>XML(SEQUENCE)</type> Type</title>
 
      <para>
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 3bf8d021c3..0d484b0fb6 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -13888,7 +13888,7 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
     documents for processing in client applications.
    </para>
 
-   <sect3>
+   <sect3 id="functions-producing-xml-xmlcomment">
     <title><literal>xmlcomment</literal></title>
 
     <indexterm>
@@ -13920,7 +13920,7 @@ SELECT xmlcomment('hello');
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="functions-producing-xml-xmlconcat">
     <title><literal>xmlconcat</literal></title>
 
     <indexterm>
@@ -13977,7 +13977,7 @@ SELECT xmlconcat('<?xml version="1.1"?><foo/>', '<?xml version="1.1" standalone=
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="functions-producing-xml-xmlelement">
     <title><literal>xmlelement</literal></title>
 
    <indexterm>
@@ -14083,7 +14083,7 @@ SELECT xmlelement(name foo, xmlattributes('xyz' as bar),
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="functions-producing-xml-xmlforest">
     <title><literal>xmlforest</literal></title>
 
    <indexterm>
@@ -14144,7 +14144,7 @@ WHERE table_schema = 'pg_catalog';
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="functions-producing-xml-xmlpi">
     <title><literal>xmlpi</literal></title>
 
    <indexterm>
@@ -14177,7 +14177,7 @@ SELECT xmlpi(name php, 'echo "hello world";');
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="functions-producing-xml-xmlroot">
     <title><literal>xmlroot</literal></title>
 
    <indexterm>
@@ -14279,7 +14279,7 @@ SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
      of <type>xml</type> values.
     </para>
 
-   <sect3>
+   <sect3 id="functions-producing-xml-is-document">
     <title><literal>IS DOCUMENT</literal></title>
 
     <indexterm>
@@ -14299,7 +14299,7 @@ SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="functions-producing-xml-is-not-document">
     <title><literal>IS NOT DOCUMENT</literal></title>
 
     <indexterm>
@@ -21499,7 +21499,7 @@ WHERE EXISTS (SELECT 1 FROM tab2 WHERE col2 = tab1.col2);
   </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="functions-subquery-single-row-comp">
    <title>Single-Row Comparison</title>
 
    <indexterm zone="functions-subquery">
@@ -21622,7 +21622,7 @@ OR
   </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="functions-comparisons-not-in">
    <title><literal>NOT IN</literal></title>
 
 <synopsis>
@@ -21663,7 +21663,7 @@ AND
   </tip>
   </sect2>
 
-  <sect2>
+  <sect2 id="functions-comparisons-any-some">
    <title><literal>ANY</literal>/<literal>SOME</literal> (array)</title>
 
 <synopsis>
@@ -21700,7 +21700,7 @@ AND
   </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="functions-comparisons-all">
    <title><literal>ALL</literal> (array)</title>
 
 <synopsis>
diff --git a/doc/src/sgml/fuzzystrmatch.sgml b/doc/src/sgml/fuzzystrmatch.sgml
index 382e54be91..5dedbd8f7a 100644
--- a/doc/src/sgml/fuzzystrmatch.sgml
+++ b/doc/src/sgml/fuzzystrmatch.sgml
@@ -26,7 +26,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="fuzzystrmatch-soundex">
   <title>Soundex</title>
 
   <para>
@@ -88,7 +88,7 @@ SELECT * FROM s WHERE difference(s.nm, 'john') &gt; 2;
 </programlisting>
  </sect2>
 
- <sect2>
+ <sect2 id="fuzzystrmatch-levenshtein">
   <title>Levenshtein</title>
 
   <para>
@@ -159,7 +159,7 @@ test=# SELECT levenshtein_less_equal('extensive', 'exhaustive', 4);
 </screen>
  </sect2>
 
- <sect2>
+ <sect2 id="fuzzystrmatch-metaphone">
   <title>Metaphone</title>
 
   <para>
@@ -200,7 +200,7 @@ test=# SELECT metaphone('GUMBO', 4);
 </screen>
  </sect2>
 
- <sect2>
+ <sect2 id="fuzzystrmatch-double-metaphone">
   <title>Double Metaphone</title>
 
   <para>
diff --git a/doc/src/sgml/geqo.sgml b/doc/src/sgml/geqo.sgml
index ac552efd84..82bf3b690d 100644
--- a/doc/src/sgml/geqo.sgml
+++ b/doc/src/sgml/geqo.sgml
@@ -173,7 +173,7 @@
     non-exhaustive search.
    </para>
 
-  <sect2>
+  <sect2 id="geqo-pg-intro-gen-possible-plans">
    <title>Generating Possible Plans with <acronym>GEQO</acronym></title>
 
    <para>
diff --git a/doc/src/sgml/history.sgml b/doc/src/sgml/history.sgml
index aa171823a8..5273c47580 100644
--- a/doc/src/sgml/history.sgml
+++ b/doc/src/sgml/history.sgml
@@ -183,7 +183,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="history-postgresql">
   <title><productname>PostgreSQL</productname></title>
 
   <para>
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index 335d64641b..815ef641a0 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -21,7 +21,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="hstore-external-rep">
   <title><type>hstore</type> External Representation</title>
 
   <para>
@@ -88,7 +88,7 @@ key =&gt; NULL
 
  </sect2>
 
- <sect2>
+ <sect2 id="hstore-ops-funcs">
   <title><type>hstore</type> Operators and Functions</title>
 
   <para>
@@ -738,7 +738,7 @@ SELECT h FROM mytable;
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="hstore-indexes">
   <title>Indexes</title>
 
   <para>
@@ -784,7 +784,7 @@ CREATE INDEX hidx ON testhstore USING HASH (h);
 </programlisting>
  </sect2>
 
- <sect2>
+ <sect2 id="hstore-examples">
   <title>Examples</title>
 
   <para>
@@ -853,7 +853,7 @@ SELECT (r).* FROM (SELECT t #= '"col3"=&gt;"baz"' AS r FROM test t) s;
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="hstore-statistics">
   <title>Statistics</title>
 
   <para>
@@ -900,7 +900,7 @@ SELECT key, count(*) FROM
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="hstore-compatibility">
   <title>Compatibility</title>
 
   <para>
@@ -933,7 +933,7 @@ ALTER TABLE tablename ALTER hstorecol TYPE hstore USING hstorecol || '';
 
  </sect2>
 
- <sect2>
+ <sect2 id="hstore-transforms">
   <title>Transforms</title>
 
   <para>
@@ -957,7 +957,7 @@ ALTER TABLE tablename ALTER hstorecol TYPE hstore USING hstorecol || '';
   </caution>
  </sect2>
 
- <sect2>
+ <sect2 id="hstore-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windows.sgml
index bbd4960e7b..2db44db2fd 100644
--- a/doc/src/sgml/install-windows.sgml
+++ b/doc/src/sgml/install-windows.sgml
@@ -154,7 +154,7 @@ $ENV{MSBFLAGS}="/m";
 </programlisting>
  </para>
 
- <sect2>
+ <sect2 id="install-windows-full-requirements">
   <title>Requirements</title>
   <para>
    The following additional products are required to build
@@ -348,7 +348,7 @@ $ENV{MSBFLAGS}="/m";
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="install-windows-full-64-bit">
   <title>Special Considerations for 64-Bit Windows</title>
 
   <para>
@@ -372,7 +372,7 @@ $ENV{MSBFLAGS}="/m";
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="install-windows-full-build">
   <title>Building</title>
 
   <para>
@@ -409,7 +409,7 @@ $ENV{CONFIG}="Debug";
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="install-windows-full-clean-inst">
   <title>Cleaning and Installing</title>
 
   <para>
@@ -442,7 +442,7 @@ $ENV{CONFIG}="Debug";
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="install-windows-full-reg-tests">
   <title>Running the Regression Tests</title>
 
   <para>
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index ef50d1a6e8..8dfb8236d0 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -677,7 +677,7 @@ build-postgresql:
      </para>
 
      <variablelist>
-      <varlistentry>
+      <varlistentry id="configure-option-prefix">
        <term><option>--prefix=<replaceable>PREFIX</replaceable></option></term>
        <listitem>
         <para>
@@ -690,7 +690,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-exec-prefix">
        <term><option>--exec-prefix=<replaceable>EXEC-PREFIX</replaceable></option></term>
        <listitem>
         <para>
@@ -706,7 +706,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-bindir">
        <term><option>--bindir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -717,7 +717,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-sysconfdir">
        <term><option>--sysconfdir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -727,7 +727,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-libdir">
        <term><option>--libdir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -738,7 +738,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-includedir">
        <term><option>--includedir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -748,7 +748,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-datarootdir">
        <term><option>--datarootdir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -760,7 +760,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-datadir">
        <term><option>--datadir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -772,7 +772,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-localedir">
        <term><option>--localedir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -783,7 +783,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-mandir">
        <term><option>--mandir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -795,7 +795,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-docdir">
        <term><option>--docdir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -807,7 +807,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-htmldir">
        <term><option>--htmldir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -862,7 +862,7 @@ build-postgresql:
 
      <variablelist>
 
-      <varlistentry>
+      <varlistentry id="configure-option-enable-nls">
        <term><option>--enable-nls<optional>=<replaceable>LANGUAGES</replaceable></optional></option></term>
        <listitem>
         <para>
@@ -885,7 +885,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-perl">
        <term><option>--with-perl</option></term>
        <listitem>
         <para>
@@ -894,7 +894,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-python">
        <term><option>--with-python</option></term>
        <listitem>
         <para>
@@ -903,7 +903,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-tcl">
        <term><option>--with-tcl</option></term>
        <listitem>
         <para>
@@ -912,7 +912,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-tclconfig">
        <term><option>--with-tclconfig=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -926,7 +926,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-icu">
        <term><option>--with-icu</option></term>
        <listitem>
         <para>
@@ -996,7 +996,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-lz4">
        <term><option>--with-lz4</option></term>
        <listitem>
         <para>
@@ -1005,7 +1005,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-zstd">
        <term><option>--with-zstd</option></term>
        <listitem>
         <para>
@@ -1014,7 +1014,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-ssl">
        <term><option>--with-ssl=<replaceable>LIBRARY</replaceable></option>
        <indexterm>
         <primary>OpenSSL</primary>
@@ -1035,7 +1035,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-openssl">
        <term><option>--with-openssl</option></term>
        <listitem>
         <para>
@@ -1044,7 +1044,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-gssapi">
        <term><option>--with-gssapi</option></term>
        <listitem>
         <para>
@@ -1061,7 +1061,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-ldap">
        <term><option>--with-ldap</option></term>
        <listitem>
         <para>
@@ -1079,7 +1079,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-pam">
        <term><option>--with-pam</option></term>
        <listitem>
         <para>
@@ -1089,7 +1089,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-bsd-auth">
        <term><option>--with-bsd-auth</option></term>
        <listitem>
         <para>
@@ -1100,7 +1100,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-systemd">
        <term><option>--with-systemd</option></term>
        <listitem>
         <para>
@@ -1115,7 +1115,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-bonjour">
        <term><option>--with-bonjour</option></term>
        <listitem>
         <para>
@@ -1126,7 +1126,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-uuid">
        <term><option>--with-uuid=<replaceable>LIBRARY</replaceable></option></term>
        <listitem>
         <para>
@@ -1160,7 +1160,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-ossp-uuid">
        <term><option>--with-ossp-uuid</option></term>
        <listitem>
         <para>
@@ -1169,7 +1169,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-libxml">
        <term><option>--with-libxml</option></term>
        <listitem>
         <para>
@@ -1202,7 +1202,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-libxslt">
        <term><option>--with-libxslt</option></term>
        <listitem>
         <para>
@@ -1231,7 +1231,7 @@ build-postgresql:
 
      <variablelist>
 
-      <varlistentry>
+      <varlistentry id="configure-option-without-readline">
        <term><option>--without-readline</option></term>
        <listitem>
         <para>
@@ -1243,7 +1243,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-libedit-preferred">
        <term><option>--with-libedit-preferred</option></term>
        <listitem>
         <para>
@@ -1255,7 +1255,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-without-zlib">
        <term><option>--without-zlib</option></term>
        <listitem>
         <para>
@@ -1270,7 +1270,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-disable-spinlocks">
        <term><option>--disable-spinlocks</option></term>
        <listitem>
         <para>
@@ -1286,7 +1286,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-disable-atomics">
        <term><option>--disable-atomics</option></term>
        <listitem>
         <para>
@@ -1298,7 +1298,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-disable-thread-safety">
        <term><option>--disable-thread-safety</option></term>
        <listitem>
         <para>
@@ -1320,7 +1320,7 @@ build-postgresql:
 
      <variablelist>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-includes">
        <term><option>--with-includes=<replaceable>DIRECTORIES</replaceable></option></term>
        <listitem>
         <para>
@@ -1338,7 +1338,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-libraries">
        <term><option>--with-libraries=<replaceable>DIRECTORIES</replaceable></option></term>
        <listitem>
         <para>
@@ -1354,7 +1354,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-system-tzdata">
        <term><option>--with-system-tzdata=<replaceable>DIRECTORY</replaceable></option>
        <indexterm>
         <primary>time zone data</primary>
@@ -1394,7 +1394,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-extra-version">
        <term><option>--with-extra-version=<replaceable>STRING</replaceable></option></term>
        <listitem>
         <para>
@@ -1407,7 +1407,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-disable-rpath">
        <term><option>--disable-rpath</option></term>
        <listitem>
         <para>
@@ -1441,7 +1441,7 @@ build-postgresql:
 
      <variablelist>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-pgport">
        <term><option>--with-pgport=<replaceable>NUMBER</replaceable></option></term>
        <listitem>
         <para>
@@ -1456,7 +1456,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-krb-srvnam">
        <term><option>--with-krb-srvnam=<replaceable>NAME</replaceable></option></term>
        <listitem>
         <para>
@@ -1470,7 +1470,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-segsize">
        <term><option>--with-segsize=<replaceable>SEGSIZE</replaceable></option></term>
        <listitem>
         <para>
@@ -1495,7 +1495,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-blocksize">
        <term><option>--with-blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
        <listitem>
         <para>
@@ -1511,7 +1511,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-wal-blocksize">
        <term><option>--with-wal-blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
        <listitem>
         <para>
@@ -1553,7 +1553,7 @@ build-postgresql:
 
      <variablelist>
 
-      <varlistentry>
+      <varlistentry id="configure-option-enable-debug">
        <term><option>--enable-debug</option></term>
        <listitem>
         <para>
@@ -1571,7 +1571,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-enable-cassert">
        <term><option>--enable-cassert</option></term>
        <listitem>
         <para>
@@ -1590,7 +1590,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-enable-tap-tests">
        <term><option>--enable-tap-tests</option></term>
        <listitem>
         <para>
@@ -1601,7 +1601,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-enable-depend">
        <term><option>--enable-depend</option></term>
        <listitem>
         <para>
@@ -1615,7 +1615,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-enable-coverage">
        <term><option>--enable-coverage</option></term>
        <listitem>
         <para>
@@ -1630,7 +1630,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-enable-profiling">
        <term><option>--enable-profiling</option></term>
        <listitem>
         <para>
@@ -1643,7 +1643,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-enable-dtrace">
        <term><option>--enable-dtrace</option></term>
        <listitem>
         <para>
@@ -1746,7 +1746,7 @@ build-postgresql:
      this manner:
 
      <variablelist>
-      <varlistentry>
+      <varlistentry id="configure-envvars-bison">
        <term><envar>BISON</envar></term>
        <listitem>
         <para>
@@ -1755,7 +1755,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cc">
        <term><envar>CC</envar></term>
        <listitem>
         <para>
@@ -1764,7 +1764,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cflags">
        <term><envar>CFLAGS</envar></term>
        <listitem>
         <para>
@@ -1773,7 +1773,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-clang">
        <term><envar>CLANG</envar></term>
        <listitem>
         <para>
@@ -1783,7 +1783,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cpp">
        <term><envar>CPP</envar></term>
        <listitem>
         <para>
@@ -1792,7 +1792,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cppflags">
        <term><envar>CPPFLAGS</envar></term>
        <listitem>
         <para>
@@ -1801,7 +1801,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cxx">
        <term><envar>CXX</envar></term>
        <listitem>
         <para>
@@ -1810,7 +1810,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cxxflags">
        <term><envar>CXXFLAGS</envar></term>
        <listitem>
         <para>
@@ -1819,7 +1819,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-dtrace">
        <term><envar>DTRACE</envar></term>
        <listitem>
         <para>
@@ -1828,7 +1828,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-dtraceflags">
        <term><envar>DTRACEFLAGS</envar></term>
        <listitem>
         <para>
@@ -1837,7 +1837,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-flex">
        <term><envar>FLEX</envar></term>
        <listitem>
         <para>
@@ -1846,7 +1846,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-ldflags">
        <term><envar>LDFLAGS</envar></term>
        <listitem>
         <para>
@@ -1855,7 +1855,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-ldflags_ex">
        <term><envar>LDFLAGS_EX</envar></term>
        <listitem>
         <para>
@@ -1864,7 +1864,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-ldflags_sl">
        <term><envar>LDFLAGS_SL</envar></term>
        <listitem>
         <para>
@@ -1873,7 +1873,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-llvm_config">
        <term><envar>LLVM_CONFIG</envar></term>
        <listitem>
         <para>
@@ -1883,7 +1883,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-msgfmt">
        <term><envar>MSGFMT</envar></term>
        <listitem>
         <para>
@@ -1892,7 +1892,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-perl">
        <term><envar>PERL</envar></term>
        <listitem>
         <para>
@@ -1903,7 +1903,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-python">
        <term><envar>PYTHON</envar></term>
        <listitem>
         <para>
@@ -1915,7 +1915,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-tclsh">
        <term><envar>TCLSH</envar></term>
        <listitem>
         <para>
@@ -1928,7 +1928,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-xml2_config">
        <term><envar>XML2_CONFIG</envar></term>
        <listitem>
         <para>
@@ -2220,7 +2220,7 @@ ninja install
      </para>
 
      <variablelist>
-      <varlistentry>
+      <varlistentry id="configure-prefix-meson">
        <term><option>--prefix=<replaceable>PREFIX</replaceable></option></term>
        <listitem>
         <para>
@@ -2234,7 +2234,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-bindir-meson">
        <term><option>--bindir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2244,7 +2244,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-sysconfdir-meson">
        <term><option>--sysconfdir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2254,7 +2254,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-libdir-meson">
        <term><option>--libdir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2265,7 +2265,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-includedir-meson">
        <term><option>--includedir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2275,7 +2275,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-datadir-meson">
        <term><option>--datadir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2287,7 +2287,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-localedir-meson">
        <term><option>--localedir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2298,7 +2298,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-mandir-meson">
        <term><option>--mandir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2359,7 +2359,7 @@ ninja install
     </para>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="configure-with-nls-meson">
       <term><option>-Dnls={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2372,7 +2372,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-plperl-meson">
       <term><option>-Dplperl={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2382,7 +2382,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-plpython-meson">
       <term><option>-Dplpython={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2392,7 +2392,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-pltcl-meson">
       <term><option>-Dpltcl={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2402,7 +2402,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-tcl_version-meson">
       <term><option>-Dtcl_version=<replaceable>TCL_VERSION</replaceable></option></term>
       <listitem>
        <para>
@@ -2411,7 +2411,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-icu-meson">
       <term><option>-Dicu={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2451,7 +2451,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-lz4-meson">
       <term><option>-Dlz4={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2461,7 +2461,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-zstd-meson">
       <term><option>-Dzstd={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2471,7 +2471,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-ssl-meson">
       <term><option>-Dssl=<replaceable>LIBRARY</replaceable></option>
       <indexterm>
        <primary>OpenSSL</primary>
@@ -2491,7 +2491,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-gssapi-meson">
       <term><option>-Dgssapi={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2508,7 +2508,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-ldap-meson">
       <term><option>-Dldap={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2527,7 +2527,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-pam-meson">
       <term><option>-Dpam={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2538,7 +2538,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-bsd_auth-meson">
       <term><option>-Dbsd_auth={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2548,7 +2548,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-systemd-meson">
       <term><option>-Dsystemd={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2564,7 +2564,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-bonjour-meson">
       <term><option>-Dbonjour={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2575,7 +2575,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-uuid-meson">
       <term><option>-Duuid=<replaceable>LIBRARY</replaceable></option></term>
       <listitem>
        <para>
@@ -2614,7 +2614,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-libxml-meson">
       <term><option>-Dlibxml={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2630,7 +2630,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-libxslt-meson">
       <term><option>-Dlibxslt={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2649,7 +2649,7 @@ ninja install
     <title>Anti-Features</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="configure-readline-meson">
       <term><option>-Dreadline={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2661,7 +2661,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-libedit_preferred-meson">
       <term><option>-Dlibedit_preferred={ true | false }</option></term>
       <listitem>
        <para>
@@ -2674,7 +2674,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-zlib-meson">
       <term><option>-Dzlib={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2689,7 +2689,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-spinlocks-meson">
       <term><option>-Dspinlocks={ true | false }</option></term>
       <listitem>
        <para>
@@ -2706,7 +2706,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-atomics-meson">
       <term><option>-Datomics={ true | false }</option></term>
       <listitem>
        <para>
@@ -2725,7 +2725,7 @@ ninja install
     <title>Build Process Details</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="configure-auto_features-meson">
       <term><option>--auto_features={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2739,7 +2739,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-backend-meson">
       <term><option>--backend=<replaceable>BACKEND</replaceable></option></term>
       <listitem>
        <para>
@@ -2751,7 +2751,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-c_args-meson">
       <term><option>-Dc_args=<replaceable>OPTIONS</replaceable></option></term>
       <listitem>
        <para>
@@ -2760,7 +2760,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-c_link_args-meson">
       <term><option>-Dc_link_args=<replaceable>OPTIONS</replaceable></option></term>
       <listitem>
        <para>
@@ -2769,7 +2769,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-extra_include_dirs-meson">
       <term><option>-Dextra_include_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
       <listitem>
        <para>
@@ -2787,7 +2787,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-extra_lib_dirs-meson">
       <term><option>-Dextra_lib_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
       <listitem>
        <para>
@@ -2803,7 +2803,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-system_tzdata-meson">
       <term><option>-Dsystem_tzdata=<replaceable>DIRECTORY</replaceable></option>
       <indexterm>
        <primary>time zone data</primary>
@@ -2842,7 +2842,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-extra_version-meson">
       <term><option>-Dextra_version=<replaceable>STRING</replaceable></option></term>
       <listitem>
        <para>
@@ -2856,7 +2856,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-binary_name-meson">
       <term><option>-D<replaceable>BINARY_NAME</replaceable>=<replaceable>PATH</replaceable></option></term>
       <listitem>
        <para>
@@ -2876,7 +2876,7 @@ ninja install
     <title>Miscellaneous</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="configure-pgport-meson">
       <term><option>-Dpgport=<replaceable>NUMBER</replaceable></option></term>
       <listitem>
        <para>
@@ -2891,7 +2891,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-krb_srvnam-meson">
       <term><option>-Dkrb_srvnam=<replaceable>NAME</replaceable></option></term>
       <listitem>
        <para>
@@ -2905,7 +2905,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-segsize-meson">
       <term><option>-Dsegsize=<replaceable>SEGSIZE</replaceable></option></term>
       <listitem>
        <para>
@@ -2927,7 +2927,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-blocksize-meson">
       <term><option>-Dblocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
       <listitem>
        <para>
@@ -2940,7 +2940,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-wal_blocksize-meson">
       <term><option>-Dwal_blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
       <listitem>
        <para>
@@ -2975,7 +2975,7 @@ ninja install
     </para>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="configure-buildtype-meson">
       <term><option>--buildtype=<replaceable>BUILDTYPE</replaceable></option></term>
       <listitem>
        <para>
@@ -2997,7 +2997,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-debug-meson">
       <term><option>--debug</option></term>
       <listitem>
        <para>
@@ -3014,7 +3014,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-optimization-meson">
       <term><option>--optimization</option>=<replaceable>LEVEL</replaceable></term>
       <listitem>
        <para>
@@ -3023,7 +3023,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-werror-meson">
       <term><option>--werror</option></term>
       <listitem>
        <para>
@@ -3033,7 +3033,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-cassert-meson">
       <term><option>-Dcassert</option></term>
       <listitem>
        <para>
@@ -3051,7 +3051,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-tap-tests-meson">
       <term><option>-Dtap-tests={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -3063,7 +3063,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-pg_test_extra-meson">
       <term><option>-DPG_TEST_EXTRA=<replaceable>TEST_SUITES</replaceable></option></term>
       <listitem>
        <para>
@@ -3074,7 +3074,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-b_coverage-meson">
       <term><option>-Db_coverage</option></term>
       <listitem>
        <para>
@@ -3089,7 +3089,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-dtrace-meson">
       <term><option>-Ddtrace={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -3221,7 +3221,7 @@ libpq.so.2.1: cannot open shared object file: No such file or directory
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="install-post-env-vars">
    <title>Environment Variables</title>
 
    <indexterm>
@@ -3372,7 +3372,7 @@ export MANPATH
     community.
    </para>
 
-   <sect3>
+   <sect3 id="installation-notes-aix-mem-management">
     <title>Memory Management</title>
     <!-- https://archives.postgresql.org/message-id/603bgqmpl9.fsf@dba2.int.libertyrms.com -->
 
@@ -3720,7 +3720,7 @@ xcrun --show-sdk-path
     operating system, the fewer issues you will experience.
    </para>
 
-   <sect3>
+   <sect3 id="installation-notes-solaris-req-tools">
     <title>Required Tools</title>
 
     <para>
@@ -3745,7 +3745,7 @@ xcrun --show-sdk-path
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="installation-notes-solaris-configure-complains">
     <title>configure Complains About a Failed Test Program</title>
 
     <para>
@@ -3764,7 +3764,7 @@ configure ... LDFLAGS="-R /usr/sfw/lib:/opt/sfw/lib:/usr/local/lib"
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="installation-notes-solaris-comp-opt-perf">
     <title>Compiling for Optimal Performance</title>
 
     <para>
@@ -3785,7 +3785,7 @@ configure ... LDFLAGS="-R /usr/sfw/lib:/opt/sfw/lib:/usr/local/lib"
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="installation-notes-solaris-using-dtrace">
     <title>Using DTrace for Tracing PostgreSQL</title>
 
     <para>
diff --git a/doc/src/sgml/intagg.sgml b/doc/src/sgml/intagg.sgml
index c410f64f3e..56ed510b48 100644
--- a/doc/src/sgml/intagg.sgml
+++ b/doc/src/sgml/intagg.sgml
@@ -15,7 +15,7 @@
   the built-in functions.
  </para>
 
- <sect2>
+ <sect2  id="intagg-functions">
   <title>Functions</title>
 
  <indexterm>
@@ -50,7 +50,7 @@
 
  </sect2>
 
- <sect2>
+ <sect2  id="intagg-samples">
   <title>Sample Uses</title>
 
   <para>
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index 18c6f8c3ba..c861f50497 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -30,7 +30,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="intarray-funcs-ops">
   <title><filename>intarray</filename> Functions and Operators</title>
 
   <para>
@@ -391,7 +391,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="intarray-index">
   <title>Index Support</title>
 
   <para>
@@ -443,7 +443,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="intarray-example">
   <title>Example</title>
 
 <programlisting>
@@ -464,7 +464,7 @@ SELECT message.mid FROM message WHERE message.sections @@ '1&amp;2'::query_int;
 </programlisting>
  </sect2>
 
- <sect2>
+ <sect2 id="intarray-benchmark">
   <title>Benchmark</title>
 
   <para>
@@ -488,7 +488,7 @@ psql -c "CREATE EXTENSION intarray" TEST
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="intarray-Authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/isn.sgml b/doc/src/sgml/isn.sgml
index 709bc8345c..14bf2d14aa 100644
--- a/doc/src/sgml/isn.sgml
+++ b/doc/src/sgml/isn.sgml
@@ -27,7 +27,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="isn-data-types">
   <title>Data Types</title>
 
   <para>
@@ -156,7 +156,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="isn-casts">
   <title>Casts</title>
 
   <para>
@@ -224,7 +224,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="isn-funcs-ops">
   <title>Functions and Operators</title>
 
   <para>
@@ -337,7 +337,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="isn-examples">
   <title>Examples</title>
 
 <programlisting>
@@ -381,7 +381,7 @@ SELECT isbn13(id) FROM test;
 </programlisting>
  </sect2>
 
- <sect2>
+ <sect2 id="isn-bibliography">
   <title>Bibliography</title>
 
   <para>
@@ -409,7 +409,7 @@ SELECT isbn13(id) FROM test;
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="isn-author">
   <title>Author</title>
   <para>
    Germ&aacute;n M&eacute;ndez Bravo (Kronuz), 2004&ndash;2006
diff --git a/doc/src/sgml/jit.sgml b/doc/src/sgml/jit.sgml
index 0c6838930b..998c972e8b 100644
--- a/doc/src/sgml/jit.sgml
+++ b/doc/src/sgml/jit.sgml
@@ -256,7 +256,7 @@ SET
     <xref linkend="guc-jit-provider"/>.
    </para>
 
-   <sect3>
+   <sect3 id="jit-pluggable-provider-interface">
     <title><acronym>JIT</acronym> Provider Interface</title>
     <para>
      A <acronym>JIT</acronym> provider is loaded by dynamically loading the
diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml
index 4182d691d6..4a5e71dfc2 100644
--- a/doc/src/sgml/json.sgml
+++ b/doc/src/sgml/json.sgml
@@ -711,7 +711,7 @@ UPDATE table_name SET jsonb_field[1]['a'] = '1';
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="datatype-json-transforms">
   <title>Transforms</title>
 
   <para>
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index af278660eb..0e7ae70c70 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -878,7 +878,7 @@ PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void);
     as further described below.
    </para>
 
-   <sect3>
+   <sect3 id="libpq-connstring-keyword-value">
     <title>Keyword/Value Connection Strings</title>
 
    <para>
@@ -906,7 +906,7 @@ host=localhost port=5432 dbname=mydb connect_timeout=10
    </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="libpq-connstring-uris">
     <title>Connection URIs</title>
 
    <para>
diff --git a/doc/src/sgml/lo.sgml b/doc/src/sgml/lo.sgml
index f46cd392df..d6076aeb7f 100644
--- a/doc/src/sgml/lo.sgml
+++ b/doc/src/sgml/lo.sgml
@@ -19,7 +19,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="lo-rationale">
   <title>Rationale</title>
 
   <para>
@@ -66,7 +66,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="lo-how-to-use">
   <title>How to Use It</title>
 
   <para>
@@ -92,7 +92,7 @@ CREATE TRIGGER t_raster BEFORE UPDATE OR DELETE ON image
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="lo-limitations">
   <title>Limitations</title>
 
   <itemizedlist>
@@ -125,7 +125,7 @@ CREATE TRIGGER t_raster BEFORE UPDATE OR DELETE ON image
   </itemizedlist>
  </sect2>
 
- <sect2>
+ <sect2 id="lo-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml
index 38ee69dccc..4cf863a76f 100644
--- a/doc/src/sgml/logicaldecoding.sgml
+++ b/doc/src/sgml/logicaldecoding.sgml
@@ -237,7 +237,7 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
 
   <sect1 id="logicaldecoding-explanation">
    <title>Logical Decoding Concepts</title>
-   <sect2>
+   <sect2 id="logicaldecoding-explanation-log-dec">
     <title>Logical Decoding</title>
 
     <indexterm>
@@ -330,7 +330,7 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
     </caution>
    </sect2>
 
-   <sect2>
+   <sect2 id="logicaldecoding-explanation-output-plugins">
     <title>Output Plugins</title>
     <para>
      Output plugins transform the data from the write-ahead log's internal
@@ -338,7 +338,7 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="logicaldecoding-explanation-exported-snapshots">
     <title>Exported Snapshots</title>
     <para>
      When a new replication slot is created using the streaming replication
@@ -1085,7 +1085,7 @@ OutputPluginWrite(ctx, true);
 
   <sect1 id="logicaldecoding-synchronous">
    <title>Synchronous Replication Support for Logical Decoding</title>
-   <sect2>
+   <sect2 id="logicaldecoding-synchronous-overview">
     <title>Overview</title>
 
     <para>
diff --git a/doc/src/sgml/ltree.sgml b/doc/src/sgml/ltree.sgml
index 508f404ae8..38b76b674c 100644
--- a/doc/src/sgml/ltree.sgml
+++ b/doc/src/sgml/ltree.sgml
@@ -19,7 +19,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="ltree-definitions">
   <title>Definitions</title>
 
   <para>
@@ -187,7 +187,7 @@ Europe &amp; Russia*@ &amp; !Transportation
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="ltree-ops-funcs">
   <title>Operators and Functions</title>
 
   <para>
@@ -607,7 +607,7 @@ Europe &amp; Russia*@ &amp; !Transportation
   </table>
  </sect2>
 
- <sect2>
+ <sect2 id="ltree-indexes">
   <title>Indexes</title>
   <para>
    <filename>ltree</filename> supports several types of indexes that can speed
@@ -685,7 +685,7 @@ CREATE INDEX path_gist_idx ON test USING GIST (array_path gist__ltree_ops(siglen
   </itemizedlist>
  </sect2>
 
- <sect2>
+ <sect2 id="ltree-example">
   <title>Example</title>
 
   <para>
@@ -822,7 +822,7 @@ ltreetest=&gt; SELECT ins_label(path,2,'Space') FROM test WHERE path &lt;@ 'Top.
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="ltree-transforms">
   <title>Transforms</title>
 
   <para>
@@ -842,7 +842,7 @@ ltreetest=&gt; SELECT ins_label(path,2,'Space') FROM test WHERE path &lt;@ 'Top.
   </caution>
  </sect2>
 
- <sect2>
+ <sect2 id="ltree-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/nls.sgml b/doc/src/sgml/nls.sgml
index 827e867c67..9b6a7da870 100644
--- a/doc/src/sgml/nls.sgml
+++ b/doc/src/sgml/nls.sgml
@@ -17,7 +17,7 @@
    to do this.  This section explains how to help.
   </para>
 
-  <sect2>
+  <sect2 id="nls-translator-requirements">
    <title>Requirements</title>
 
    <para>
@@ -50,7 +50,7 @@
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="nls-translator-concepts">
    <title>Concepts</title>
 
    <para>
@@ -130,7 +130,7 @@ msgstr "another translated"
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="nls-translator-message-catalogs">
    <title>Creating and Maintaining Message Catalogs</title>
 
    <para>
@@ -199,7 +199,7 @@ make update-po
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="nls-translator-editing-po">
    <title>Editing the PO Files</title>
 
    <para>
diff --git a/doc/src/sgml/oldsnapshot.sgml b/doc/src/sgml/oldsnapshot.sgml
index a665ae72e7..0e03084562 100644
--- a/doc/src/sgml/oldsnapshot.sgml
+++ b/doc/src/sgml/oldsnapshot.sgml
@@ -13,7 +13,7 @@
   <xref linkend="guc-old-snapshot-threshold" />.
  </para>
 
- <sect2>
+ <sect2 id="oldsnapshot-functions">
   <title>Functions</title>
 
   <variablelist>
diff --git a/doc/src/sgml/pageinspect.sgml b/doc/src/sgml/pageinspect.sgml
index 04aca998e7..8674872e8b 100644
--- a/doc/src/sgml/pageinspect.sgml
+++ b/doc/src/sgml/pageinspect.sgml
@@ -13,7 +13,7 @@
   debugging purposes.  All of these functions may be used only by superusers.
  </para>
 
- <sect2>
+ <sect2 id="pageinspect-general-funcs">
   <title>General Functions</title>
 
   <variablelist>
@@ -156,7 +156,7 @@ test=# SELECT fsm_page_contents(get_raw_page('pg_class', 'fsm', 0));
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pageinspect-heap-funcs">
   <title>Heap Functions</title>
 
   <variablelist>
@@ -282,7 +282,7 @@ test=# SELECT t_ctid, raw_flags, combined_flags
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pageinspect-b-tree-funcs">
   <title>B-Tree Functions</title>
 
   <variablelist>
@@ -521,7 +521,7 @@ test=# SELECT itemoffset, ctid, itemlen, nulls, vars, data, dead, htid, tids[0:2
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pageinspect-brin-funcs">
   <title>BRIN Functions</title>
 
   <variablelist>
@@ -631,7 +631,7 @@ test=# SELECT * FROM brin_page_items(get_raw_page('brinidx', 5),
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pageinspect-gin-funcs">
   <title>GIN Functions</title>
 
   <variablelist>
@@ -721,7 +721,7 @@ test=# SELECT first_tid, nbytes, tids[0:5] AS some_tids
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pageinspect-gist-funcs">
   <title>GiST Functions</title>
 
   <variablelist>
@@ -812,7 +812,7 @@ test=# SELECT * FROM gist_page_items_bytea(get_raw_page('test_gist_idx', 0));
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pageinspect-hash-funcs">
   <title>Hash Functions</title>
 
   <variablelist>
diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml
index c3ee47b3d6..54f329cf6b 100644
--- a/doc/src/sgml/perform.sgml
+++ b/doc/src/sgml/perform.sgml
@@ -960,7 +960,7 @@ EXPLAIN ANALYZE SELECT * FROM tenk1 WHERE unique1 &lt; 100 AND unique2 &gt; 9000
    <secondary>of the planner</secondary>
   </indexterm>
 
-  <sect2>
+  <sect2 id="planner-stats-single-column">
    <title>Single-Column Statistics</title>
   <para>
    As we saw in the previous section, the query planner needs to estimate
@@ -1169,7 +1169,7 @@ WHERE tablename = 'road';
     that are currently supported.
    </para>
 
-   <sect3>
+   <sect3 id="planner-stats-extended-functional-deps">
     <title>Functional Dependencies</title>
 
     <para>
@@ -1239,7 +1239,7 @@ SELECT stxname, stxkeys, stxddependencies
      an underestimate.
     </para>
 
-    <sect4>
+    <sect4 id="planner-stats-extended-functional-deps-limits">
      <title>Limitations of Functional Dependencies</title>
 
      <para>
@@ -1280,7 +1280,7 @@ SELECT * FROM zipcodes WHERE city = 'San Francisco' AND zip = '90210';
     </sect4>
    </sect3>
 
-   <sect3>
+   <sect3 id="planner-stats-extended-n-distinct-counts">
     <title>Multivariate N-Distinct Counts</title>
 
     <para>
@@ -1333,7 +1333,7 @@ nd | {"1, 2": 33178, "1, 5": 33178, "2, 5": 27435, "1, 2, 5": 33178}
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="planner-stats-extended-mcv-lists">
     <title>Multivariate MCV Lists</title>
 
     <para>
diff --git a/doc/src/sgml/pgbuffercache.sgml b/doc/src/sgml/pgbuffercache.sgml
index 8f314ee8ff..6e49e1af5d 100644
--- a/doc/src/sgml/pgbuffercache.sgml
+++ b/doc/src/sgml/pgbuffercache.sgml
@@ -44,7 +44,7 @@
   using <command>GRANT</command>.
  </para>
 
- <sect2>
+ <sect2 id="pgbuffercache-pg_buffercache">
   <title>The <structname>pg_buffercache</structname> View</title>
 
   <para>
@@ -179,7 +179,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgbuffercache-summary">
   <title>The <function>pg_buffercache_summary()</function> Function</title>
 
   <para>
@@ -265,7 +265,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgbuffercache-sample-output">
   <title>Sample Output</title>
 
 <screen>
@@ -302,7 +302,7 @@ regression=# SELECT * FROM pg_buffercache_summary();
 </screen>
  </sect2>
 
- <sect2>
+ <sect2 id="pgbuffercache-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/pgcrypto.sgml b/doc/src/sgml/pgcrypto.sgml
index 5316472b96..a923242b2d 100644
--- a/doc/src/sgml/pgcrypto.sgml
+++ b/doc/src/sgml/pgcrypto.sgml
@@ -28,10 +28,10 @@
   OpenSSL support was not selected when PostgreSQL was built.
  </para>
 
- <sect2>
+ <sect2 id="pgcrypto-general-hashing-funcs">
   <title>General Hashing Functions</title>
 
-  <sect3>
+  <sect3 id="pgcrypto-general-hashing-funcs-digest">
    <title><function>digest()</function></title>
 
    <indexterm>
@@ -64,7 +64,7 @@ $$ LANGUAGE SQL STRICT IMMUTABLE;
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-general-hashing-funcs-hmac">
    <title><function>hmac()</function></title>
 
    <indexterm>
@@ -94,7 +94,7 @@ hmac(data bytea, key bytea, type text) returns bytea
   </sect3>
  </sect2>
 
- <sect2>
+ <sect2 id="pgcrypto-password-hashing-funcs">
   <title>Password Hashing Functions</title>
 
   <para>
@@ -193,7 +193,7 @@ hmac(data bytea, key bytea, type text) returns bytea
    </tgroup>
   </table>
 
-  <sect3>
+  <sect3 id="pgcrypto-password-hashing-funcs-crypt">
    <title><function>crypt()</function></title>
 
    <indexterm>
@@ -226,7 +226,7 @@ SELECT (pswhash = crypt('entered password', pswhash)) AS pswmatch FROM ... ;
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-password-hashing-funcs-gen_salt">
    <title><function>gen_salt()</function></title>
 
   <indexterm>
@@ -437,7 +437,7 @@ gen_salt(type text [, iter_count integer ]) returns text
   </sect3>
  </sect2>
 
- <sect2>
+ <sect2 id="pgcrypto-pgp-enc-funcs">
   <title>PGP Encryption Functions</title>
 
   <para>
@@ -535,7 +535,7 @@ gen_salt(type text [, iter_count integer ]) returns text
    </listitem>
   </orderedlist>
 
-  <sect3>
+  <sect3 id="pgcrypto-pgp-enc-funcs-pgp_sym_encrypt">
    <title><function>pgp_sym_encrypt()</function></title>
 
    <indexterm>
@@ -557,7 +557,7 @@ pgp_sym_encrypt_bytea(data bytea, psw text [, options text ]) returns bytea
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-pgp-enc-funcs-pgp_sym_decrypt">
    <title><function>pgp_sym_decrypt()</function></title>
 
    <indexterm>
@@ -586,7 +586,7 @@ pgp_sym_decrypt_bytea(msg bytea, psw text [, options text ]) returns bytea
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-pgp-enc-funcs-pgp_pub_encrypt">
    <title><function>pgp_pub_encrypt()</function></title>
 
    <indexterm>
@@ -611,7 +611,7 @@ pgp_pub_encrypt_bytea(data bytea, key bytea [, options text ]) returns bytea
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-pgp-enc-funcs-pgp_pub_decrypt">
    <title><function>pgp_pub_decrypt()</function></title>
 
    <indexterm>
@@ -644,7 +644,7 @@ pgp_pub_decrypt_bytea(msg bytea, key bytea [, psw text [, options text ]]) retur
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-pgp-enc-funcs-pgp_key_id">
    <title><function>pgp_key_id()</function></title>
 
    <indexterm>
@@ -690,7 +690,7 @@ pgp_key_id(bytea) returns text
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-pgp-enc-funcs-armor">
    <title><function>armor()</function>, <function>dearmor()</function></title>
 
    <indexterm>
@@ -719,7 +719,7 @@ dearmor(data text) returns bytea
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-pgp-enc-funcs-pgp_armor_headers">
    <title><function>pgp_armor_headers</function></title>
 
    <indexterm>
@@ -737,7 +737,7 @@ pgp_armor_headers(data text, key out text, value out text) returns setof record
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-pgp-enc-funcs-opts">
    <title>Options for PGP Functions</title>
 
    <para>
@@ -761,7 +761,7 @@ pgp_sym_encrypt(data, psw, 'compress-algo=1, cipher-algo=aes256')
     The rest should have reasonable defaults.
    </para>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-cipher-algo">
    <title>cipher-algo</title>
 
    <para>
@@ -774,7 +774,7 @@ Applies to: pgp_sym_encrypt, pgp_pub_encrypt
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-compress-algo">
    <title>compress-algo</title>
 
    <para>
@@ -791,7 +791,7 @@ Applies to: pgp_sym_encrypt, pgp_pub_encrypt
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-compress-level">
    <title>compress-level</title>
 
    <para>
@@ -805,7 +805,7 @@ Applies to: pgp_sym_encrypt, pgp_pub_encrypt
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-convert-crlf">
    <title>convert-crlf</title>
 
    <para>
@@ -822,7 +822,7 @@ Applies to: pgp_sym_encrypt, pgp_pub_encrypt, pgp_sym_decrypt, pgp_pub_decrypt
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-disable-mdc">
    <title>disable-mdc</title>
 
    <para>
@@ -838,7 +838,7 @@ Applies to: pgp_sym_encrypt, pgp_pub_encrypt
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-sess-key">
    <title>sess-key</title>
 
    <para>
@@ -853,7 +853,7 @@ Applies to: pgp_sym_encrypt
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-s2k-mode">
    <title>s2k-mode</title>
 
    <para>
@@ -869,7 +869,7 @@ Applies to: pgp_sym_encrypt
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-s2k-count">
    <title>s2k-count</title>
 
    <para>
@@ -882,7 +882,7 @@ Applies to: pgp_sym_encrypt, only with s2k-mode=3
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-s2k-digest-algo">
    <title>s2k-digest-algo</title>
 
    <para>
@@ -895,7 +895,7 @@ Applies to: pgp_sym_encrypt
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-s2k-cipher-algo">
    <title>s2k-cipher-algo</title>
 
    <para>
@@ -908,7 +908,7 @@ Applies to: pgp_sym_encrypt
 </literallayout>
   </sect4>
 
-  <sect4>
+  <sect4 id="pgcrypto-pgp-enc-funcs-opts-unicode-mode">
    <title>unicode-mode</title>
 
    <para>
@@ -925,7 +925,7 @@ Applies to: pgp_sym_encrypt, pgp_pub_encrypt
   </sect4>
   </sect3>
 
- <sect3>
+ <sect3 id="pgcrypto-pgp-enc-funcs-gnupg">
   <title>Generating PGP Keys with GnuPG</title>
 
   <para>
@@ -973,7 +973,7 @@ gpg -a --export-secret-keys KEYID > secret.key
   </para>
  </sect3>
 
- <sect3>
+ <sect3 id="pgcrypto-pgp-enc-funcs-limitations">
   <title>Limitations of PGP Code</title>
 
   <itemizedlist>
@@ -1001,7 +1001,7 @@ gpg -a --export-secret-keys KEYID > secret.key
   </sect3>
  </sect2>
 
- <sect2>
+ <sect2 id="pgcrypto-raw-enc-funcs">
   <title>Raw Encryption Functions</title>
 
   <para>
@@ -1119,7 +1119,7 @@ encrypt(data, 'fooz', 'bf-cbc/pad:pkcs')
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgcrypto-random-data-funcs">
   <title>Random-Data Functions</title>
 
   <indexterm>
@@ -1149,10 +1149,10 @@ gen_random_uuid() returns uuid
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgcrypto-notes">
   <title>Notes</title>
 
-  <sect3>
+  <sect3 id="pgcrypto-notes-config">
    <title>Configuration</title>
 
    <para>
@@ -1180,7 +1180,7 @@ gen_random_uuid() returns uuid
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-notes-null-handling">
    <title>NULL Handling</title>
 
    <para>
@@ -1189,7 +1189,7 @@ gen_random_uuid() returns uuid
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-notes-sec-limits">
    <title>Security Limitations</title>
 
    <para>
@@ -1221,7 +1221,7 @@ gen_random_uuid() returns uuid
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-notes-useful-reading">
    <title>Useful Reading</title>
 
    <itemizedlist>
@@ -1252,7 +1252,7 @@ gen_random_uuid() returns uuid
    </itemizedlist>
   </sect3>
 
-  <sect3>
+  <sect3 id="pgcrypto-notes-tech-ref">
    <title>Technical References</title>
 
    <itemizedlist>
@@ -1288,7 +1288,7 @@ gen_random_uuid() returns uuid
   </sect3>
  </sect2>
 
- <sect2>
+ <sect2 id="pgcrypto-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/pgfreespacemap.sgml b/doc/src/sgml/pgfreespacemap.sgml
index 4dd7a084b9..9d93fb5a72 100644
--- a/doc/src/sgml/pgfreespacemap.sgml
+++ b/doc/src/sgml/pgfreespacemap.sgml
@@ -21,7 +21,7 @@
   using <command>GRANT</command>.
  </para>
 
- <sect2>
+ <sect2 id="pgfreespacemap-funcs">
   <title>Functions</title>
 
   <variablelist>
@@ -71,7 +71,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgfreespacemap-sample-output">
   <title>Sample Output</title>
 
 <screen>
@@ -108,7 +108,7 @@ postgres=# SELECT * FROM pg_freespace('foo', 7);
 </screen>
  </sect2>
 
- <sect2>
+ <sect2 id="pgfreespacemap-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/pgprewarm.sgml b/doc/src/sgml/pgprewarm.sgml
index 754a21a076..e103a2746d 100644
--- a/doc/src/sgml/pgprewarm.sgml
+++ b/doc/src/sgml/pgprewarm.sgml
@@ -19,7 +19,7 @@
   will, using 2 background workers, reload those same blocks after a restart.
  </para>
 
- <sect2>
+ <sect2 id="pgprewarm-funcs">
   <title>Functions</title>
 
 <synopsis>
@@ -84,7 +84,7 @@ autoprewarm_dump_now() RETURNS int8
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgprewarm-config-params">
   <title>Configuration Parameters</title>
 
  <variablelist>
@@ -137,7 +137,7 @@ pg_prewarm.autoprewarm_interval = 300s
 
  </sect2>
 
- <sect2>
+ <sect2 id="pgprewarm-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/pgrowlocks.sgml b/doc/src/sgml/pgrowlocks.sgml
index ad15cda668..91dfd452ee 100644
--- a/doc/src/sgml/pgrowlocks.sgml
+++ b/doc/src/sgml/pgrowlocks.sgml
@@ -19,7 +19,7 @@
  </para>
 
 
- <sect2>
+ <sect2 id="pgrowlocks-overview">
   <title>Overview</title>
 
   <indexterm>
@@ -125,7 +125,7 @@ SELECT * FROM accounts AS a, pgrowlocks('accounts') AS p
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgrowlocks-sample-output">
   <title>Sample Output</title>
 
   <screen>
@@ -140,7 +140,7 @@ SELECT * FROM accounts AS a, pgrowlocks('accounts') AS p
 </screen>
  </sect2>
 
- <sect2>
+ <sect2 id="pgrowlocks-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/pgstatstatements.sgml b/doc/src/sgml/pgstatstatements.sgml
index ea90365c7f..bf69e5de3f 100644
--- a/doc/src/sgml/pgstatstatements.sgml
+++ b/doc/src/sgml/pgstatstatements.sgml
@@ -36,7 +36,7 @@
    <command>CREATE EXTENSION pg_stat_statements</command>.
  </para>
 
- <sect2>
+ <sect2 id="pgstatstatements-pg_stat_statements">
   <title>The <structname>pg_stat_statements</structname> View</title>
 
   <para>
@@ -602,7 +602,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgstatstatements-pg_stat_statements_info">
   <title>The <structname>pg_stat_statements_info</structname> View</title>
 
   <indexterm>
@@ -658,7 +658,7 @@
   </table>
  </sect2>
 
- <sect2>
+ <sect2 id="pgstatstatements-funcs">
   <title>Functions</title>
 
   <variablelist>
@@ -721,7 +721,7 @@
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pgstatstatements-config-params">
   <title>Configuration Parameters</title>
 
   <variablelist>
@@ -856,7 +856,7 @@ pg_stat_statements.track = all
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgstatstatements-sample-output">
   <title>Sample Output</title>
 
 <screen>
@@ -961,7 +961,7 @@ hit_percent     |
 </screen>
  </sect2>
 
- <sect2>
+ <sect2 id="pgstatstatements-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/pgstattuple.sgml b/doc/src/sgml/pgstattuple.sgml
index b17b3c59e0..581bea2788 100644
--- a/doc/src/sgml/pgstattuple.sgml
+++ b/doc/src/sgml/pgstattuple.sgml
@@ -23,7 +23,7 @@
   the <literal>pg_stat_scan_tables</literal> role instead.
  </para>
 
- <sect2>
+ <sect2 id="pgstattuple-funcs">
   <title>Functions</title>
 
   <variablelist>
@@ -618,7 +618,7 @@ approx_free_percent  | 2.09
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pgstattuple-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/pgsurgery.sgml b/doc/src/sgml/pgsurgery.sgml
index 4bba14f217..6c6be70c24 100644
--- a/doc/src/sgml/pgsurgery.sgml
+++ b/doc/src/sgml/pgsurgery.sgml
@@ -18,7 +18,7 @@
   They should be used with great caution and only as a last resort.
  </para>
 
- <sect2>
+ <sect2 id="pgsurgery-funcs">
   <title>Functions</title>
 
   <variablelist>
@@ -96,7 +96,7 @@ test=# select ctid from t1 where xmin = 2;
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pgsurgery-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/pgtrgm.sgml b/doc/src/sgml/pgtrgm.sgml
index fefe30afb7..f0344590dd 100644
--- a/doc/src/sgml/pgtrgm.sgml
+++ b/doc/src/sgml/pgtrgm.sgml
@@ -21,7 +21,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="pgtrgm-concepts">
   <title>Trigram (or Trigraph) Concepts</title>
 
   <para>
@@ -59,7 +59,7 @@
   </note>
  </sect2>
 
- <sect2>
+ <sect2 id="pgtrgm-funcs-ops">
   <title>Functions and Operators</title>
 
   <para>
@@ -355,7 +355,7 @@
   </table>
  </sect2>
 
- <sect2>
+ <sect2 id="pgtrgm-guc">
   <title>GUC Parameters</title>
 
   <variablelist>
@@ -406,7 +406,7 @@
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pgtrgm-index">
   <title>Index Support</title>
 
   <para>
@@ -559,7 +559,7 @@ SELECT * FROM test_trgm WHERE t ~ '(foo|bar)';
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgtrgm-text-search">
   <title>Text Search Integration</title>
 
   <para>
@@ -608,7 +608,7 @@ CREATE INDEX words_idx ON words USING GIN (word gin_trgm_ops);
   </note>
  </sect2>
 
- <sect2>
+ <sect2 id="pgtrgm-references">
   <title>References</title>
 
   <para>
@@ -621,7 +621,7 @@ CREATE INDEX words_idx ON words USING GIN (word gin_trgm_ops);
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgtrgm-authors">
   <title>Authors</title>
 
   <para>
diff --git a/doc/src/sgml/pgvisibility.sgml b/doc/src/sgml/pgvisibility.sgml
index 8090aa5207..68c43b7f39 100644
--- a/doc/src/sgml/pgvisibility.sgml
+++ b/doc/src/sgml/pgvisibility.sgml
@@ -41,7 +41,7 @@
   data blocks are similarly expensive.
  </para>
 
- <sect2>
+ <sect2 id="pgvisibility-funcs">
   <title>Functions</title>
 
   <variablelist>
@@ -147,7 +147,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="pgvisibility-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/pgwalinspect.sgml b/doc/src/sgml/pgwalinspect.sgml
index 1a1bee7d6a..0fa54cf29a 100644
--- a/doc/src/sgml/pgwalinspect.sgml
+++ b/doc/src/sgml/pgwalinspect.sgml
@@ -47,11 +47,11 @@
   superusers to others using <command>GRANT</command>.
  </para>
 
- <sect2>
+ <sect2 id="pgwalinspect-funcs">
   <title>General Functions</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="pgwalinspect-funcs-pg_get_wal_record_info">
     <term>
      <function>
       pg_get_wal_record_info(in_lsn pg_lsn,
@@ -78,7 +78,7 @@
     </listitem>
    </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="pgwalinspect-funcs-pg_get_wal_records_info">
     <term>
      <function>
       pg_get_wal_records_info(start_lsn pg_lsn,
@@ -128,7 +128,7 @@ postgres=# select start_lsn, end_lsn, prev_lsn, xid, resource_manager, record_ty
     </listitem>
    </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="pgwalinspect-funcs-pg_get_wal_records_info_till_end_of_wal">
     <term>
      <function>
       pg_get_wal_records_info_till_end_of_wal(start_lsn pg_lsn,
@@ -156,7 +156,7 @@ postgres=# select start_lsn, end_lsn, prev_lsn, xid, resource_manager, record_ty
     </listitem>
    </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="pgwalinspect-funcs-pg_get_wal_stats">
     <term>
      <function>
       pg_get_wal_stats(start_lsn pg_lsn,
@@ -234,7 +234,7 @@ postgres=# select * from pg_get_wal_stats('0/14AFC30', '0/15011D7', true) where
     </listitem>
    </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="pgwalinspect-funcs-pg_get_wal_stats_till_end_of_wal">
     <term>
      <function>
       pg_get_wal_stats_till_end_of_wal(start_lsn pg_lsn,
@@ -264,7 +264,7 @@ postgres=# select * from pg_get_wal_stats('0/14AFC30', '0/15011D7', true) where
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="pgwalinspect-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 7fc8d1467f..65d441fe7b 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1788,7 +1788,7 @@ END;
      NEXT</command>.
     </para>
 
-    <sect3>
+    <sect3 id="plpgsql-statements-returning-return">
      <title><command>RETURN</command></title>
 
 <synopsis>
@@ -1849,7 +1849,7 @@ RETURN (1, 2, 'three'::text);  -- must cast columns to correct types
      </para>
     </sect3>
 
-    <sect3>
+    <sect3 id="plpgsql-statements-returning-return-next">
      <title><command>RETURN NEXT</command> and <command>RETURN QUERY</command></title>
     <indexterm>
      <primary>RETURN NEXT</primary>
@@ -2081,7 +2081,7 @@ $$;
     </itemizedlist>
     </para>
 
-    <sect3>
+    <sect3 id="plpgsql-conditionals-if-then">
      <title><literal>IF-THEN</literal></title>
 
 <synopsis>
@@ -2108,7 +2108,7 @@ END IF;
        </para>
      </sect3>
 
-     <sect3>
+     <sect3 id="plpgsql-conditionals-if-then-else">
       <title><literal>IF-THEN-ELSE</literal></title>
 
 <synopsis>
@@ -2149,7 +2149,7 @@ END IF;
      </para>
     </sect3>
 
-     <sect3>
+     <sect3 id="plpgsql-conditionals-if-then-elsif">
       <title><literal>IF-THEN-ELSIF</literal></title>
 
 <synopsis>
@@ -2225,7 +2225,7 @@ END IF;
        </para>
      </sect3>
 
-     <sect3>
+     <sect3 id="plpgsql-conditionals-simple-case">
       <title>Simple <literal>CASE</literal></title>
 
 <synopsis>
@@ -2268,7 +2268,7 @@ END CASE;
       </para>
      </sect3>
 
-     <sect3>
+     <sect3 id="plpgsql-conditionals-searched-case">
       <title>Searched <literal>CASE</literal></title>
 
 <synopsis>
@@ -2335,7 +2335,7 @@ END CASE;
      <application>PL/pgSQL</application> function to repeat a series of commands.
     </para>
 
-    <sect3>
+    <sect3 id="plpgsql-control-structures-loops-loop">
      <title><literal>LOOP</literal></title>
 
 <synopsis>
@@ -2355,7 +2355,7 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>;
      </para>
     </sect3>
 
-     <sect3>
+     <sect3 id="plpgsql-control-structures-loops-exit">
       <title><literal>EXIT</literal></title>
 
      <indexterm>
@@ -2427,7 +2427,7 @@ END;
        </para>
      </sect3>
 
-     <sect3>
+     <sect3 id="plpgsql-control-structures-loops-continue">
       <title><literal>CONTINUE</literal></title>
 
      <indexterm>
@@ -2476,7 +2476,7 @@ END LOOP;
      </sect3>
 
 
-     <sect3>
+     <sect3 id="plpgsql-control-structures-loops-while">
       <title><literal>WHILE</literal></title>
 
      <indexterm>
@@ -3211,7 +3211,7 @@ DECLARE
      <xref linkend="plpgsql-cursor-returning"/>.
     </para>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-opening-open-for-query">
      <title><command>OPEN FOR</command> <replaceable>query</replaceable></title>
 
 <synopsis>
@@ -3245,7 +3245,7 @@ OPEN curs1 FOR SELECT * FROM foo WHERE key = mykey;
        </para>
      </sect3>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-opening-open-for-execute">
      <title><command>OPEN FOR EXECUTE</command></title>
 
 <synopsis>
@@ -3370,7 +3370,7 @@ BEGIN
      only until the end of the transaction.
     </para>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-using-fetch">
      <title><literal>FETCH</literal></title>
 
 <synopsis>
@@ -3427,7 +3427,7 @@ FETCH RELATIVE -2 FROM curs4 INTO x;
        </para>
      </sect3>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-using-move">
      <title><literal>MOVE</literal></title>
 
 <synopsis>
@@ -3454,7 +3454,7 @@ MOVE FORWARD 2 FROM curs4;
        </para>
      </sect3>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-using-update-delete">
      <title><literal>UPDATE/DELETE WHERE CURRENT OF</literal></title>
 
 <synopsis>
@@ -3480,7 +3480,7 @@ UPDATE foo SET dataval = myval WHERE CURRENT OF curs1;
        </para>
      </sect3>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-using-close">
      <title><literal>CLOSE</literal></title>
 
 <synopsis>
@@ -3831,7 +3831,7 @@ RAISE NOTICE 'Calling cs_create_job(%)', v_job_id;
     class="parameter">option</replaceable> key words are:
 
     <variablelist id="raise-using-options">
-     <varlistentry>
+     <varlistentry id="raise-using-option-message">
       <term><literal>MESSAGE</literal></term>
       <listitem>
        <para>Sets the error message text.  This option can't be used in the
@@ -3840,21 +3840,21 @@ RAISE NOTICE 'Calling cs_create_job(%)', v_job_id;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="raise-using-option-detail">
       <term><literal>DETAIL</literal></term>
       <listitem>
        <para>Supplies an error detail message.</para>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="raise-using-option-hint">
       <term><literal>HINT</literal></term>
       <listitem>
        <para>Supplies a hint message.</para>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="raise-using-option-errcode">
       <term><literal>ERRCODE</literal></term>
       <listitem>
        <para>Specifies the error code (SQLSTATE) to report, either by condition
@@ -3863,7 +3863,7 @@ RAISE NOTICE 'Calling cs_create_job(%)', v_job_id;
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="raise-using-option-column-et-al">
       <term><literal>COLUMN</literal></term>
       <term><literal>CONSTRAINT</literal></term>
       <term><literal>DATATYPE</literal></term>
@@ -4053,7 +4053,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
    top-level block. They are:
 
    <variablelist>
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-new">
      <term><varname>NEW</varname> <type>record</type></term>
      <listitem>
       <para>
@@ -4064,7 +4064,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-old">
      <term><varname>OLD</varname> <type>record</type></term>
      <listitem>
       <para>
@@ -4075,7 +4075,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_name">
      <term><varname>TG_NAME</varname> <type>name</type></term>
      <listitem>
       <para>
@@ -4084,7 +4084,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_when">
      <term><varname>TG_WHEN</varname> <type>text</type></term>
      <listitem>
       <para>
@@ -4094,7 +4094,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_level">
      <term><varname>TG_LEVEL</varname> <type>text</type></term>
      <listitem>
       <para>
@@ -4104,7 +4104,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_op">
      <term><varname>TG_OP</varname> <type>text</type></term>
      <listitem>
       <para>
@@ -4115,7 +4115,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_relid">
      <term><varname>TG_RELID</varname> <type>oid</type> (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)</term>
      <listitem>
       <para>
@@ -4124,7 +4124,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_relname">
      <term><varname>TG_RELNAME</varname> <type>name</type></term>
      <listitem>
       <para>
@@ -4135,7 +4135,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_table_name">
      <term><varname>TG_TABLE_NAME</varname> <type>name</type></term>
      <listitem>
       <para>
@@ -4144,7 +4144,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_table_schema">
      <term><varname>TG_TABLE_SCHEMA</varname> <type>name</type></term>
      <listitem>
       <para>
@@ -4153,7 +4153,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_nargs">
      <term><varname>TG_NARGS</varname> <type>integer</type></term>
      <listitem>
       <para>
@@ -4163,7 +4163,7 @@ ASSERT <replaceable class="parameter">condition</replaceable> <optional> , <repl
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-dml-trigger-tg_argv">
      <term><varname>TG_ARGV</varname> <type>text[]</type></term>
      <listitem>
       <para>
@@ -4668,7 +4668,7 @@ CREATE TRIGGER emp_audit_del
     in the top-level block. They are:
 
    <variablelist>
-    <varlistentry>
+    <varlistentry id="plpgsql-event-trigger-tg_event">
      <term><varname>TG_EVENT</varname> <type>text</type></term>
      <listitem>
       <para>
@@ -4677,7 +4677,7 @@ CREATE TRIGGER emp_audit_del
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="plpgsql-event-trigger-tg_tag">
      <term><varname>TG_TAG</varname> <type>text</type></term>
      <listitem>
       <para>
@@ -5131,7 +5131,7 @@ $PROC$ LANGUAGE plpgsql;
   </para>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="plpgsql-quote-tips-1-quot">
     <term>1 quotation mark</term>
     <listitem>
      <para>
@@ -5147,7 +5147,7 @@ CREATE FUNCTION foo() RETURNS integer AS '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="plpgsql-quote-tips-2-quot">
     <term>2 quotation marks</term>
     <listitem>
      <para>
@@ -5167,7 +5167,7 @@ SELECT * FROM users WHERE f_name='foobar';
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="plpgsql-quote-tips-4-quot">
     <term>4 quotation marks</term>
     <listitem>
      <para>
@@ -5190,7 +5190,7 @@ a_output := a_output || $$ AND name LIKE 'foobar' AND xyz$$
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="plpgsql-quote-tips-6-quot">
     <term>6 quotation marks</term>
     <listitem>
      <para>
@@ -5211,7 +5211,7 @@ a_output := a_output || $$ AND name LIKE 'foobar'$$
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="plpgsql-quote-tips-10-quot">
     <term>10 quotation marks</term>
     <listitem>
      <para>
@@ -5276,7 +5276,7 @@ a_output := a_output || $$ if v_$$ || referrer_keys.kind || $$ like '$$
     <literal>"all"</literal>. The default is <literal>"none"</literal>. Currently
     the list of available checks includes:
     <variablelist>
-     <varlistentry>
+     <varlistentry id="plpgsql-extra-checks-shadowed_variables">
       <term><varname>shadowed_variables</varname></term>
       <listitem>
        <para>
@@ -5285,7 +5285,7 @@ a_output := a_output || $$ if v_$$ || referrer_keys.kind || $$ like '$$
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="plpgsql-extra-checks-strict_multi_assignment">
       <term><varname>strict_multi_assignment</varname></term>
       <listitem>
        <para>
@@ -5303,7 +5303,7 @@ a_output := a_output || $$ if v_$$ || referrer_keys.kind || $$ like '$$
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="plpgsql-extra-checks-too_many_rows">
       <term><varname>too_many_rows</varname></term>
       <listitem>
        <para>
@@ -5488,7 +5488,7 @@ HINT:  Make sure the query returns the exact list of columns.
     </itemizedlist>
    </para>
 
-  <sect2>
+  <sect2 id="plpgsql-porting-examples">
    <title>Porting Examples</title>
 
    <para>
@@ -5924,7 +5924,7 @@ END;
     </para>
    </sect3>
 
-   <sect3>
+   <sect3 id="plpgsql-porting-other-execute">
     <title><command>EXECUTE</command></title>
 
     <para>
diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml
index 54355effd7..e190c90f45 100644
--- a/doc/src/sgml/plpython.sgml
+++ b/doc/src/sgml/plpython.sgml
@@ -153,7 +153,7 @@ $$ LANGUAGE plpython3u;
    below.
   </para>
 
-  <sect2>
+  <sect2 id="plpython-data-type-mapping">
    <title>Data Type Mapping</title>
    <para>
     When a PL/Python function is called, its arguments are converted from
@@ -269,7 +269,7 @@ $$ LANGUAGE plpython3u;
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="plpython-data-null">
    <title>Null, None</title>
   <para>
    If an SQL null value<indexterm><primary>null value</primary><secondary
@@ -369,7 +369,7 @@ SELECT return_str_arr();
   </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="plpython-data-composite-types">
    <title>Composite Types</title>
   <para>
    Composite-type arguments are passed to the function as Python mappings. The
@@ -516,7 +516,7 @@ CALL python_triple(5, 10);
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="plpython-data-set-returning-funcs">
    <title>Set-Returning Functions</title>
   <para>
    A <application>PL/Python</application> function can also return sets of
@@ -779,7 +779,7 @@ $$ LANGUAGE plpython3u;
    <literal>plpy.<replaceable>foo</replaceable></literal>.
   </para>
 
-  <sect2>
+  <sect2 id="plpython-database-access-funcs">
     <title>Database Access Functions</title>
 
   <para>
@@ -1115,7 +1115,7 @@ $$ LANGUAGE plpython3u;
    the form of explicit subtransactions.
   </para>
 
-  <sect2>
+  <sect2 id="plpython-subtransaction-context-managers">
    <title>Subtransaction Context Managers</title>
 
    <para>
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml
index 6c94318485..78f2d7d8d5 100644
--- a/doc/src/sgml/postgres-fdw.sgml
+++ b/doc/src/sgml/postgres-fdw.sgml
@@ -106,10 +106,10 @@
   of columns to the remote table is by name, not position.
  </para>
 
- <sect2>
+ <sect2 id="postgres-fdw-options">
   <title>FDW Options of postgres_fdw</title>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-connection">
    <title>Connection Options</title>
 
    <para>
@@ -197,7 +197,7 @@ OPTIONS (ADD password_required 'false');
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-object-name">
    <title>Object Name Options</title>
 
    <para>
@@ -246,7 +246,7 @@ OPTIONS (ADD password_required 'false');
 
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-cost-estimation">
    <title>Cost Estimation Options</title>
 
    <para>
@@ -363,7 +363,7 @@ OPTIONS (ADD password_required 'false');
 
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-remote-execution">
    <title>Remote Execution Options</title>
 
    <para>
@@ -444,7 +444,7 @@ OPTIONS (ADD password_required 'false');
 
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-asynchronous-execution">
    <title>Asynchronous Execution Options</title>
 
    <para>
@@ -495,7 +495,7 @@ OPTIONS (ADD password_required 'false');
    </variablelist>
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-transaction-management">
    <title>Transaction Management Options</title>
 
    <para>
@@ -545,7 +545,7 @@ OPTIONS (ADD password_required 'false');
 
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-updatability">
    <title>Updatability Options</title>
 
    <para>
@@ -582,7 +582,7 @@ OPTIONS (ADD password_required 'false');
    </variablelist>
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-truncatability">
    <title>Truncatability Options</title>
 
    <para>
@@ -613,7 +613,7 @@ OPTIONS (ADD password_required 'false');
    </variablelist>
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-importing">
    <title>Importing Options</title>
 
    <para>
@@ -721,7 +721,7 @@ OPTIONS (ADD password_required 'false');
 
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-connection-management">
     <title>Connection Management Options</title>
 
     <para>
@@ -750,7 +750,7 @@ OPTIONS (ADD password_required 'false');
    </sect3>
  </sect2>
 
-<sect2>
+<sect2 id="postgres-fdw-functions">
   <title>Functions</title>
 
   <variablelist>
@@ -829,7 +829,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
 
 </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-connection-management">
   <title>Connection Management</title>
 
   <para>
@@ -866,7 +866,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-transaction-management">
   <title>Transaction Management</title>
 
   <para>
@@ -901,7 +901,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-remote-query-optimization">
   <title>Remote Query Optimization</title>
 
   <para>
@@ -944,7 +944,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-remote-query-execution-environment">
   <title>Remote Query Execution Environment</title>
 
   <para>
@@ -1000,7 +1000,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-cross-version-compatibility">
   <title>Cross-Version Compatibility</title>
 
   <para>
@@ -1020,7 +1020,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-configuration-parameters">
   <title>Configuration Parameters</title>
 
   <variablelist>
@@ -1120,7 +1120,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-examples">
   <title>Examples</title>
 
   <para>
@@ -1184,7 +1184,7 @@ CREATE FOREIGN TABLE foreign_table (
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-author">
   <title>Author</title>
   <para>
    Shigeru Hanada <email>shigeru.hanada@gmail.com</email>
diff --git a/doc/src/sgml/problems.sgml b/doc/src/sgml/problems.sgml
index cf43262872..4a1cf49f74 100644
--- a/doc/src/sgml/problems.sgml
+++ b/doc/src/sgml/problems.sgml
@@ -28,7 +28,7 @@
   If you need help immediately, consider obtaining a commercial support contract.
  </para>
 
- <sect2>
+ <sect2 id="bug-reporting-identifying-bugs">
   <title>Identifying Bugs</title>
 
   <para>
@@ -96,7 +96,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="bug-reporting-what-to-report">
   <title>What to Report</title>
 
   <para>
@@ -291,7 +291,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="bug-reporting-where-to-report-bugs">
   <title>Where to Report Bugs</title>
 
   <para>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 03312e07e2..a640851442 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -216,7 +216,7 @@
    after the start-up phase.
   </para>
 
-  <sect2>
+  <sect2 id="protocol-flow-start-up">
    <title>Start-up</title>
 
    <para>
@@ -529,7 +529,7 @@
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-simple-query">
    <title>Simple Query</title>
 
    <para>
@@ -1109,7 +1109,7 @@ SELCT 1/0;<!-- this typo is intentional -->
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-function-call">
    <title>Function Call</title>
 
    <para>
@@ -1386,7 +1386,7 @@ SELCT 1/0;<!-- this typo is intentional -->
    </note>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-canceling-requests">
    <title>Canceling Requests in Progress</title>
 
    <para>
@@ -1450,7 +1450,7 @@ SELCT 1/0;<!-- this typo is intentional -->
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-termination">
    <title>Termination</title>
 
    <para>
@@ -1490,7 +1490,7 @@ SELCT 1/0;<!-- this typo is intentional -->
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-ssl">
    <title><acronym>SSL</acronym> Session Encryption</title>
 
    <para>
@@ -1563,7 +1563,7 @@ SELCT 1/0;<!-- this typo is intentional -->
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-gssapi">
    <title><acronym>GSSAPI</acronym> Session Encryption</title>
 
    <para>
diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml
index 47e6369f1a..45741e773b 100644
--- a/doc/src/sgml/queries.sgml
+++ b/doc/src/sgml/queries.sgml
@@ -2492,7 +2492,7 @@ SELECT n FROM t <emphasis>LIMIT 100</emphasis>;
   </sect3>
  </sect2>
 
- <sect2>
+ <sect2 id="queries-with-cte-materialization">
   <title>Common Table Expression Materialization</title>
 
   <para>
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 43d782fea9..557257c593 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -153,7 +153,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
    lock acquired will be the strictest one required by any subcommand.
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-add-column">
     <term><literal>ADD COLUMN [ IF NOT EXISTS ]</literal></term>
     <listitem>
      <para>
@@ -165,7 +165,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-drop-column">
     <term><literal>DROP COLUMN [ IF EXISTS ]</literal></term>
     <listitem>
      <para>
@@ -184,7 +184,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-data-type">
     <term><literal>SET DATA TYPE</literal></term>
     <listitem>
      <para>
@@ -211,7 +211,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-drop-default">
     <term><literal>SET</literal>/<literal>DROP DEFAULT</literal></term>
     <listitem>
      <para>
@@ -224,7 +224,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-drop-not-null">
     <term><literal>SET</literal>/<literal>DROP NOT NULL</literal></term>
     <listitem>
      <para>
@@ -255,7 +255,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-drop-expression">
     <term><literal>DROP EXPRESSION [ IF EXISTS ]</literal></term>
     <listitem>
      <para>
@@ -272,7 +272,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-generated-identity">
     <term><literal>ADD GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY</literal></term>
     <term><literal>SET GENERATED { ALWAYS | BY DEFAULT }</literal></term>
     <term><literal>DROP IDENTITY [ IF EXISTS ]</literal></term>
@@ -295,7 +295,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-sequence_option">
     <term><literal>SET <replaceable>sequence_option</replaceable></literal></term>
     <term><literal>RESTART</literal></term>
     <listitem>
@@ -308,7 +308,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-statistics">
     <term><literal>SET STATISTICS</literal></term>
     <listitem>
      <para>
@@ -329,7 +329,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-attribute_option">
     <term><literal>SET ( <replaceable class="parameter">attribute_option</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ] )</literal></term>
     <term><literal>RESET ( <replaceable class="parameter">attribute_option</replaceable> [, ... ] )</literal></term>
     <listitem>
@@ -365,7 +365,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-storage">
     <term>
      <literal>SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT }</literal>
      <indexterm>
@@ -399,7 +399,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-compression">
     <term>
      <literal>SET COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal>
     </term>
@@ -429,7 +429,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-add-table_constraint">
     <term><literal>ADD <replaceable class="parameter">table_constraint</replaceable> [ NOT VALID ]</literal></term>
     <listitem>
      <para>
@@ -476,7 +476,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-add-table_constraint_using_index">
     <term><literal>ADD <replaceable class="parameter">table_constraint_using_index</replaceable></literal></term>
     <listitem>
      <para>
@@ -531,7 +531,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-alter-constraint">
     <term><literal>ALTER CONSTRAINT</literal></term>
     <listitem>
      <para>
@@ -541,7 +541,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-validate-constraint">
     <term><literal>VALIDATE CONSTRAINT</literal></term>
     <listitem>
      <para>
@@ -558,7 +558,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-drop-constraint">
     <term><literal>DROP CONSTRAINT [ IF EXISTS ]</literal></term>
     <listitem>
      <para>
@@ -570,7 +570,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-disable-enable-trigger">
     <term><literal>DISABLE</literal>/<literal>ENABLE [ REPLICA | ALWAYS ] TRIGGER</literal></term>
     <listitem>
      <para>
@@ -617,7 +617,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-disable-enable-rule">
     <term><literal>DISABLE</literal>/<literal>ENABLE [ REPLICA | ALWAYS ] RULE</literal></term>
     <listitem>
      <para>
@@ -637,7 +637,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-disable-enable-row-level-security">
     <term><literal>DISABLE</literal>/<literal>ENABLE ROW LEVEL SECURITY</literal></term>
     <listitem>
      <para>
@@ -652,7 +652,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-force-row-level-security">
     <term><literal>NO FORCE</literal>/<literal>FORCE ROW LEVEL SECURITY</literal></term>
     <listitem>
      <para>
@@ -667,7 +667,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-cluster-on">
     <term><literal>CLUSTER ON</literal></term>
     <listitem>
      <para>
@@ -681,7 +681,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-without-cluster">
     <term><literal>SET WITHOUT CLUSTER</literal></term>
     <listitem>
      <para>
@@ -696,7 +696,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-without-oids">
     <term><literal>SET WITHOUT OIDS</literal></term>
     <listitem>
      <para>
@@ -707,7 +707,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-access-method">
     <term><literal>SET ACCESS METHOD</literal></term>
     <listitem>
      <para>
@@ -717,7 +717,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-tablespace">
     <term><literal>SET TABLESPACE</literal></term>
     <listitem>
      <para>
@@ -749,7 +749,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-logged-unlogged">
     <term><literal>SET { LOGGED | UNLOGGED }</literal></term>
     <listitem>
      <para>
@@ -766,7 +766,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-storage_parameter">
     <term><literal>SET ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -792,7 +792,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-reset-storage_parameter">
     <term><literal>RESET ( <replaceable class="parameter">storage_parameter</replaceable> [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -803,7 +803,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-inherit">
     <term><literal>INHERIT <replaceable class="parameter">parent_table</replaceable></literal></term>
     <listitem>
      <para>
@@ -831,7 +831,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-no-inherit">
     <term><literal>NO INHERIT <replaceable class="parameter">parent_table</replaceable></literal></term>
     <listitem>
      <para>
@@ -843,7 +843,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-of">
     <term><literal>OF <replaceable class="parameter">type_name</replaceable></literal></term>
     <listitem>
      <para>
@@ -857,7 +857,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-not-of">
     <term><literal>NOT OF</literal></term>
     <listitem>
      <para>
@@ -866,7 +866,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-owner-to">
     <term><literal>OWNER TO</literal></term>
     <listitem>
      <para>
@@ -887,7 +887,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       always logged regardless of whether it changed.
       This option has no effect except when logical replication is in use.
      <variablelist>
-      <varlistentry>
+      <varlistentry id="sql-altertable-replica-identity-default">
        <term><literal>DEFAULT</literal></term>
        <listitem>
         <para>
@@ -897,7 +897,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="sql-altertable-replica-identity-using-index">
        <term><literal>USING INDEX <replaceable class="parameter">index_name</replaceable></literal></term>
        <listitem>
         <para>
@@ -909,7 +909,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="sql-altertable-replica-identity-full">
        <term><literal>FULL</literal></term>
        <listitem>
         <para>
@@ -918,7 +918,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="sql-altertable-replica-identity-nothing">
        <term><literal>NOTHING</literal></term>
        <listitem>
         <para>
@@ -931,7 +931,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-rename">
     <term><literal>RENAME</literal></term>
     <listitem>
      <para>
@@ -945,7 +945,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-altertable-desc-set-schema">
     <term><literal>SET SCHEMA</literal></term>
     <listitem>
      <para>
@@ -1122,7 +1122,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
 
     <variablelist>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-if-exists">
       <term><literal>IF EXISTS</literal></term>
       <listitem>
        <para>
@@ -1132,7 +1132,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-name">
       <term><replaceable class="parameter">name</replaceable></term>
       <listitem>
        <para>
@@ -1146,7 +1146,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-column_name">
       <term><replaceable class="parameter">column_name</replaceable></term>
       <listitem>
        <para>
@@ -1155,7 +1155,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-new_column_name">
       <term><replaceable class="parameter">new_column_name</replaceable></term>
       <listitem>
        <para>
@@ -1164,7 +1164,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-new_name">
       <term><replaceable class="parameter">new_name</replaceable></term>
       <listitem>
        <para>
@@ -1173,7 +1173,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-data_type">
       <term><replaceable class="parameter">data_type</replaceable></term>
       <listitem>
        <para>
@@ -1183,7 +1183,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-table_constraint">
       <term><replaceable class="parameter">table_constraint</replaceable></term>
       <listitem>
        <para>
@@ -1192,7 +1192,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-constraint_name">
       <term><replaceable class="parameter">constraint_name</replaceable></term>
       <listitem>
        <para>
@@ -1201,7 +1201,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-cascade">
       <term><literal>CASCADE</literal></term>
       <listitem>
        <para>
@@ -1213,7 +1213,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-restrict">
       <term><literal>RESTRICT</literal></term>
       <listitem>
        <para>
@@ -1223,7 +1223,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-trigger_name">
       <term><replaceable class="parameter">trigger_name</replaceable></term>
       <listitem>
        <para>
@@ -1232,7 +1232,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-all">
       <term><literal>ALL</literal></term>
       <listitem>
        <para>
@@ -1245,7 +1245,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-user">
       <term><literal>USER</literal></term>
       <listitem>
        <para>
@@ -1257,7 +1257,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-index_name">
       <term><replaceable class="parameter">index_name</replaceable></term>
       <listitem>
        <para>
@@ -1266,7 +1266,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-storage_parameter">
       <term><replaceable class="parameter">storage_parameter</replaceable></term>
       <listitem>
        <para>
@@ -1275,7 +1275,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-value">
       <term><replaceable class="parameter">value</replaceable></term>
       <listitem>
        <para>
@@ -1285,7 +1285,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-parent_table">
       <term><replaceable class="parameter">parent_table</replaceable></term>
       <listitem>
        <para>
@@ -1294,7 +1294,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-new_owner">
       <term><replaceable class="parameter">new_owner</replaceable></term>
       <listitem>
        <para>
@@ -1303,7 +1303,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-new_access_method">
       <term><replaceable class="parameter">new_access_method</replaceable></term>
       <listitem>
        <para>
@@ -1312,7 +1312,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-new_tablespace">
       <term><replaceable class="parameter">new_tablespace</replaceable></term>
       <listitem>
        <para>
@@ -1321,7 +1321,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-new_schema">
       <term><replaceable class="parameter">new_schema</replaceable></term>
       <listitem>
        <para>
@@ -1330,7 +1330,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-partition_name">
       <term><replaceable class="parameter">partition_name</replaceable></term>
       <listitem>
        <para>
@@ -1339,7 +1339,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-altertable-parms-partition_bound_spec">
       <term><replaceable class="parameter">partition_bound_spec</replaceable></term>
       <listitem>
        <para>
diff --git a/doc/src/sgml/ref/commit.sgml b/doc/src/sgml/ref/commit.sgml
index 5f244cdd3c..7e2dcac5a3 100644
--- a/doc/src/sgml/ref/commit.sgml
+++ b/doc/src/sgml/ref/commit.sgml
@@ -43,7 +43,7 @@ COMMIT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
   </indexterm>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-commit-transaction">
     <term><literal>WORK</literal></term>
     <term><literal>TRANSACTION</literal></term>
     <listitem>
diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml
index ea38c64731..42678753a7 100644
--- a/doc/src/sgml/ref/create_database.sgml
+++ b/doc/src/sgml/ref/create_database.sgml
@@ -74,7 +74,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
   <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="create-database-name">
       <term><replaceable class="parameter">name</replaceable></term>
       <listitem>
        <para>
@@ -82,7 +82,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
        </para>
       </listitem>
      </varlistentry>
-     <varlistentry>
+     <varlistentry id="create-database-user_name">
       <term><replaceable class="parameter">user_name</replaceable></term>
       <listitem>
        <para>
@@ -94,7 +94,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
        </para>
       </listitem>
      </varlistentry>
-     <varlistentry>
+     <varlistentry id="create-database-template">
       <term><replaceable class="parameter">template</replaceable></term>
       <listitem>
        <para>
@@ -104,7 +104,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
        </para>
       </listitem>
      </varlistentry>
-     <varlistentry>
+     <varlistentry id="create-database-encoding">
       <term><replaceable class="parameter">encoding</replaceable></term>
       <listitem>
        <para>
@@ -140,7 +140,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
        </para>
       </listitem>
      </varlistentry>
-     <varlistentry>
+     <varlistentry id="create-database-locale">
       <term><replaceable class="parameter">locale</replaceable></term>
       <listitem>
        <para>
@@ -159,7 +159,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
        </tip>
       </listitem>
      </varlistentry>
-     <varlistentry>
+     <varlistentry id="create-database-lc_collate">
       <term><replaceable class="parameter">lc_collate</replaceable></term>
       <listitem>
        <para>
@@ -171,7 +171,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
        </para>
       </listitem>
      </varlistentry>
-     <varlistentry>
+     <varlistentry id="create-database-lc_ctype">
       <term><replaceable class="parameter">lc_ctype</replaceable></term>
       <listitem>
        <para>
@@ -183,7 +183,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="create-database-icu_locale">
       <term><replaceable class="parameter">icu_locale</replaceable></term>
       <listitem>
        <para>
@@ -192,7 +192,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="create-database-locale_provider">
       <term><replaceable>locale_provider</replaceable></term>
 
       <listitem>
@@ -206,7 +206,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="create-database-collation_version">
       <term><replaceable>collation_version</replaceable></term>
 
       <listitem>
@@ -225,7 +225,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
        </para>
      </listitem>
     </varlistentry>
-     <varlistentry>
+     <varlistentry id="create-database-tablespace_name">
       <term><replaceable class="parameter">tablespace_name</replaceable></term>
       <listitem>
        <para>
@@ -240,7 +240,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
       </listitem>
      </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="create-database-allowconn">
        <term><replaceable class="parameter">allowconn</replaceable></term>
        <listitem>
         <para>
@@ -251,7 +251,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="create-database-connlimit">
       <term><replaceable class="parameter">connlimit</replaceable></term>
       <listitem>
        <para>
@@ -261,7 +261,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
       </listitem>
      </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="create-database-istemplate">
        <term><replaceable class="parameter">istemplate</replaceable></term>
        <listitem>
         <para>
@@ -272,7 +272,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="create-database-oid">
        <term><replaceable class="parameter">oid</replaceable></term>
        <listitem>
         <para>
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index c98223b2a5..49a592449c 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -223,7 +223,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-if-not-exists">
     <term><literal>IF NOT EXISTS</literal></term>
     <listitem>
      <para>
@@ -235,7 +235,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-table_name">
     <term><replaceable class="parameter">table_name</replaceable></term>
     <listitem>
      <para>
@@ -244,7 +244,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-type_name">
     <term><literal>OF <replaceable class="parameter">type_name</replaceable></literal></term>
     <listitem>
      <para>
@@ -265,7 +265,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-column_name">
     <term><replaceable class="parameter">column_name</replaceable></term>
     <listitem>
      <para>
@@ -274,7 +274,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-data_type">
     <term><replaceable class="parameter">data_type</replaceable></term>
     <listitem>
      <para>
@@ -286,7 +286,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-collate">
     <term><literal>COLLATE <replaceable>collation</replaceable></literal></term>
     <listitem>
      <para>
@@ -297,7 +297,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-storage">
     <term>
      <literal>STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT }</literal>
      <indexterm>
@@ -326,7 +326,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-compression">
     <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term>
     <listitem>
      <para>
@@ -351,7 +351,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-inherits">
     <term><literal>INHERITS ( <replaceable>parent_table</replaceable> [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -408,7 +408,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-partition-by">
     <term><literal>PARTITION BY { RANGE | LIST | HASH } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ <replaceable class="parameter">opclass</replaceable> ] [, ...] ) </literal></term>
     <listitem>
      <para>
@@ -624,7 +624,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-like">
     <term><literal>LIKE <replaceable>source_table</replaceable> [ <replaceable>like_option</replaceable> ... ]</literal></term>
     <listitem>
      <para>
@@ -656,7 +656,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       available options are:
 
       <variablelist>
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-comments">
         <term><literal>INCLUDING COMMENTS</literal></term>
         <listitem>
          <para>
@@ -668,7 +668,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-compression">
         <term><literal>INCLUDING COMPRESSION</literal></term>
         <listitem>
          <para>
@@ -679,7 +679,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-constraints">
         <term><literal>INCLUDING CONSTRAINTS</literal></term>
         <listitem>
          <para>
@@ -690,7 +690,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-defaults">
         <term><literal>INCLUDING DEFAULTS</literal></term>
         <listitem>
          <para>
@@ -704,7 +704,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-generated">
         <term><literal>INCLUDING GENERATED</literal></term>
         <listitem>
          <para>
@@ -714,7 +714,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-identity">
         <term><literal>INCLUDING IDENTITY</literal></term>
         <listitem>
          <para>
@@ -726,7 +726,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-indexes">
         <term><literal>INCLUDING INDEXES</literal></term>
         <listitem>
          <para>
@@ -740,7 +740,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-statistics">
         <term><literal>INCLUDING STATISTICS</literal></term>
         <listitem>
          <para>
@@ -749,7 +749,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-storage">
         <term><literal>INCLUDING STORAGE</literal></term>
         <listitem>
          <para>
@@ -763,7 +763,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-like-opt-all">
         <term><literal>INCLUDING ALL</literal></term>
         <listitem>
          <para>
@@ -787,7 +787,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-constraint">
     <term><literal>CONSTRAINT <replaceable class="parameter">constraint_name</replaceable></literal></term>
     <listitem>
      <para>
@@ -801,7 +801,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-not-null">
     <term><literal>NOT NULL</literal></term>
     <listitem>
      <para>
@@ -810,7 +810,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-null">
     <term><literal>NULL</literal></term>
     <listitem>
      <para>
@@ -825,7 +825,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-check">
     <term><literal>CHECK ( <replaceable class="parameter">expression</replaceable> ) [ NO INHERIT ] </literal></term>
     <listitem>
      <para>
@@ -863,7 +863,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-default">
     <term><literal>DEFAULT
     <replaceable>default_expr</replaceable></literal></term>
     <listitem>
@@ -884,7 +884,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-generated-stored">
     <term><literal>GENERATED ALWAYS AS ( <replaceable>generation_expr</replaceable> ) STORED</literal><indexterm><primary>generated column</primary></indexterm></term>
     <listitem>
      <para>
@@ -906,7 +906,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-generated-identity">
     <term><literal>GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( <replaceable>sequence_options</replaceable> ) ]</literal></term>
     <listitem>
      <para>
@@ -950,7 +950,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-unique">
     <term><literal>UNIQUE [ NULLS [ NOT ] DISTINCT ]</literal> (column constraint)</term>
     <term><literal>UNIQUE [ NULLS [ NOT ] DISTINCT ] ( <replaceable class="parameter">column_name</replaceable> [, ... ] )</literal>
     <optional> <literal>INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...])</literal> </optional> (table constraint)</term>
@@ -1004,7 +1004,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-primary-key">
     <term><literal>PRIMARY KEY</literal> (column constraint)</term>
     <term><literal>PRIMARY KEY ( <replaceable class="parameter">column_name</replaceable> [, ... ] )</literal>
     <optional> <literal>INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...])</literal> </optional> (table constraint)</term>
@@ -1107,7 +1107,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-references">
     <term><literal>REFERENCES <replaceable class="parameter">reftable</replaceable> [ ( <replaceable class="parameter">refcolumn</replaceable> ) ] [ MATCH <replaceable class="parameter">matchtype</replaceable> ] [ ON DELETE <replaceable class="parameter">referential_action</replaceable> ] [ ON UPDATE <replaceable class="parameter">referential_action</replaceable> ]</literal> (column constraint)</term>
 
    <term><literal>FOREIGN KEY ( <replaceable class="parameter">column_name</replaceable> [, ... ] )
@@ -1167,7 +1167,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       actions for each clause:
 
       <variablelist>
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-references-refact-no-action">
         <term><literal>NO ACTION</literal></term>
         <listitem>
          <para>
@@ -1180,7 +1180,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-references-refact-restrict">
         <term><literal>RESTRICT</literal></term>
         <listitem>
          <para>
@@ -1192,7 +1192,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-references-refact-cascade">
         <term><literal>CASCADE</literal></term>
         <listitem>
          <para>
@@ -1203,7 +1203,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-references-refact-set-null">
         <term><literal>SET NULL [ ( <replaceable>column_name</replaceable> [, ... ] ) ]</literal></term>
         <listitem>
          <para>
@@ -1214,7 +1214,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-references-refact-set-default">
         <term><literal>SET DEFAULT [ ( <replaceable>column_name</replaceable> [, ... ] ) ]</literal></term>
         <listitem>
          <para>
@@ -1238,7 +1238,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-deferrable">
     <term><literal>DEFERRABLE</literal></term>
     <term><literal>NOT DEFERRABLE</literal></term>
     <listitem>
@@ -1260,7 +1260,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-initially">
     <term><literal>INITIALLY IMMEDIATE</literal></term>
     <term><literal>INITIALLY DEFERRED</literal></term>
     <listitem>
@@ -1290,7 +1290,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-with">
     <term><literal>WITH ( <replaceable class="parameter">storage_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -1304,7 +1304,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-without-oids">
     <term><literal>WITHOUT OIDS</literal></term>
     <listitem>
      <para>
@@ -1315,7 +1315,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-on-commit">
     <term><literal>ON COMMIT</literal></term>
     <listitem>
      <para>
@@ -1324,7 +1324,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       The three options are:
 
       <variablelist>
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-on-commit-preserve-rows">
         <term><literal>PRESERVE ROWS</literal></term>
         <listitem>
          <para>
@@ -1334,7 +1334,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-on-commit-delete-rows">
         <term><literal>DELETE ROWS</literal></term>
         <listitem>
          <para>
@@ -1347,7 +1347,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createtable-parms-on-commit-drop">
         <term><literal>DROP</literal></term>
         <listitem>
          <para>
@@ -1379,7 +1379,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createtable-parms-using-index-tablespace">
     <term><literal>USING INDEX TABLESPACE <replaceable class="parameter">tablespace_name</replaceable></literal></term>
     <listitem>
      <para>
diff --git a/doc/src/sgml/ref/initdb.sgml b/doc/src/sgml/ref/initdb.sgml
index 75dc065d31..3dcc948887 100644
--- a/doc/src/sgml/ref/initdb.sgml
+++ b/doc/src/sgml/ref/initdb.sgml
@@ -138,7 +138,7 @@ PostgreSQL documentation
 
    <para>
     <variablelist>
-     <varlistentry>
+     <varlistentry id="app-initdb-option-auth">
       <term><option>-A <replaceable class="parameter">authmethod</replaceable></option></term>
       <term><option>--auth=<replaceable class="parameter">authmethod</replaceable></option></term>
       <listitem>
@@ -163,7 +163,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-auth-host">
       <term><option>--auth-host=<replaceable class="parameter">authmethod</replaceable></option></term>
       <listitem>
        <para>
@@ -174,7 +174,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-auth-local">
       <term><option>--auth-local=<replaceable class="parameter">authmethod</replaceable></option></term>
       <listitem>
        <para>
@@ -185,7 +185,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-pgdata">
       <term><option>-D <replaceable class="parameter">directory</replaceable></option></term>
       <term><option>--pgdata=<replaceable class="parameter">directory</replaceable></option></term>
       <listitem>
@@ -201,7 +201,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-encoding">
       <term><option>-E <replaceable class="parameter">encoding</replaceable></option></term>
       <term><option>--encoding=<replaceable class="parameter">encoding</replaceable></option></term>
       <listitem>
@@ -230,7 +230,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-icu-locale">
       <term><option>--icu-locale=<replaceable>locale</replaceable></option></term>
       <listitem>
        <para>
@@ -256,7 +256,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-locale">
       <term><option>--locale=<replaceable>locale</replaceable></option></term>
       <listitem>
        <para>
@@ -268,7 +268,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-lc-collate-et-al">
       <term><option>--lc-collate=<replaceable>locale</replaceable></option></term>
       <term><option>--lc-ctype=<replaceable>locale</replaceable></option></term>
       <term><option>--lc-messages=<replaceable>locale</replaceable></option></term>
@@ -284,7 +284,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-no-locale">
       <term><option>--no-locale</option></term>
       <listitem>
        <para>
@@ -293,7 +293,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-locale-provider">
       <term><option>--locale-provider={<literal>libc</literal>|<literal>icu</literal>}</option></term>
       <listitem>
        <para>
@@ -305,7 +305,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-no-sync">
       <term><option>-N</option></term>
       <term><option>--no-sync</option></term>
       <listitem>
@@ -320,7 +320,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-no-instructions">
       <term><option>--no-instructions</option></term>
       <listitem>
        <para>
@@ -333,7 +333,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-pwfile">
       <term><option>--pwfile=<replaceable>filename</replaceable></option></term>
       <listitem>
        <para>
@@ -343,7 +343,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-sync-only">
       <term><option>-S</option></term>
       <term><option>--sync-only</option></term>
       <listitem>
@@ -357,7 +357,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-text-search-config">
       <term><option>-T <replaceable>config</replaceable></option></term>
       <term><option>--text-search-config=<replaceable>config</replaceable></option></term>
       <listitem>
@@ -368,7 +368,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-username">
       <term><option>-U <replaceable class="parameter">username</replaceable></option></term>
       <term><option>--username=<replaceable class="parameter">username</replaceable></option></term>
       <listitem>
@@ -381,7 +381,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-pwprompt">
       <term><option>-W</option></term>
       <term><option>--pwprompt</option></term>
       <listitem>
@@ -395,7 +395,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-initdb-option-waldir">
       <term><option>-X <replaceable class="parameter">directory</replaceable></option></term>
       <term><option>--waldir=<replaceable class="parameter">directory</replaceable></option></term>
       <listitem>
@@ -406,7 +406,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-wal-segsize">
       <term><option>--wal-segsize=<replaceable>size</replaceable></option></term>
       <listitem>
        <para>
@@ -433,7 +433,7 @@ PostgreSQL documentation
     Other, less commonly used, options are also available:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="app-initdb-option-debug">
       <term><option>-d</option></term>
       <term><option>--debug</option></term>
       <listitem>
@@ -447,7 +447,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-discard-caches">
       <term><option>--discard-caches</option></term>
       <listitem>
        <para>
@@ -458,7 +458,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-l">
       <term><option>-L <replaceable class="parameter">directory</replaceable></option></term>
       <listitem>
        <para>
@@ -470,7 +470,7 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-no-clean">
       <term><option>-n</option></term>
       <term><option>--no-clean</option></term>
       <listitem>
@@ -490,7 +490,7 @@ PostgreSQL documentation
     Other options:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="app-initdb-option-version">
        <term><option>-V</option></term>
        <term><option>--version</option></term>
        <listitem>
@@ -500,7 +500,7 @@ PostgreSQL documentation
        </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-initdb-option-help">
        <term><option>-?</option></term>
        <term><option>--help</option></term>
        <listitem>
@@ -520,7 +520,7 @@ PostgreSQL documentation
   <title>Environment</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="app-initdb-environment-pgdata">
     <term><envar>PGDATA</envar></term>
 
     <listitem>
@@ -531,7 +531,7 @@ PostgreSQL documentation
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-initdb-environment-pg_color">
     <term><envar>PG_COLOR</envar></term>
     <listitem>
      <para>
@@ -542,7 +542,7 @@ PostgreSQL documentation
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-initdb-environment-tz">
     <term><envar>TZ</envar></term>
 
     <listitem>
diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml
index 40e6a50a7f..4dfdb5cd3e 100644
--- a/doc/src/sgml/ref/pgbench.sgml
+++ b/doc/src/sgml/ref/pgbench.sgml
@@ -161,7 +161,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
 
     <variablelist>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-dbname">
       <term><replaceable class="parameter">dbname</replaceable></term>
       <listitem>
        <para>
@@ -173,7 +173,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-initialize">
       <term><option>-i</option></term>
       <term><option>--initialize</option></term>
       <listitem>
@@ -183,7 +183,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-init-steps">
       <term><option>-I <replaceable>init_steps</replaceable></option></term>
       <term><option>--init-steps=<replaceable>init_steps</replaceable></option></term>
       <listitem>
@@ -196,7 +196,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
         The available steps are:
 
         <variablelist>
-         <varlistentry>
+         <varlistentry id="pgbench-option-init-steps-d">
           <term><literal>d</literal> (Drop)</term>
           <listitem>
            <para>
@@ -204,7 +204,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
            </para>
           </listitem>
          </varlistentry>
-         <varlistentry>
+         <varlistentry id="pgbench-option-init-steps-t">
           <term><literal>t</literal> (create Tables)</term>
           <listitem>
            <para>
@@ -217,7 +217,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
            </para>
           </listitem>
          </varlistentry>
-         <varlistentry>
+         <varlistentry id="pgbench-option-init-steps-g">
           <term><literal>g</literal> or <literal>G</literal> (Generate data, client-side or server-side)</term>
           <listitem>
            <para>
@@ -251,7 +251,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
            </para>
           </listitem>
          </varlistentry>
-         <varlistentry>
+         <varlistentry id="pgbench-option-init-steps-v">
           <term><literal>v</literal> (Vacuum)</term>
           <listitem>
            <para>
@@ -259,7 +259,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
            </para>
           </listitem>
          </varlistentry>
-         <varlistentry>
+         <varlistentry id="pgbench-option-init-steps-p">
           <term><literal>p</literal> (create Primary keys)</term>
           <listitem>
            <para>
@@ -267,7 +267,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
            </para>
           </listitem>
          </varlistentry>
-         <varlistentry>
+         <varlistentry id="pgbench-option-init-steps-f">
          <term><literal>f</literal> (create Foreign keys)</term>
           <listitem>
            <para>
@@ -280,7 +280,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-fillfactor">
       <term><option>-F</option> <replaceable>fillfactor</replaceable></term>
       <term><option>--fillfactor=</option><replaceable>fillfactor</replaceable></term>
       <listitem>
@@ -293,7 +293,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-no-vacuum-init">
       <term><option>-n</option></term>
       <term><option>--no-vacuum</option></term>
       <listitem>
@@ -305,7 +305,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-quiet">
       <term><option>-q</option></term>
       <term><option>--quiet</option></term>
       <listitem>
@@ -321,7 +321,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-scale-init">
       <term><option>-s</option> <replaceable>scale_factor</replaceable></term>
       <term><option>--scale=</option><replaceable>scale_factor</replaceable></term>
       <listitem>
@@ -338,7 +338,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-foreign-keys">
       <term><option>--foreign-keys</option></term>
       <listitem>
        <para>
@@ -349,7 +349,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-index-tablespace">
       <term><option>--index-tablespace=<replaceable>index_tablespace</replaceable></option></term>
       <listitem>
        <para>
@@ -359,7 +359,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-partition-method">
       <term><option>--partition-method=<replaceable>NAME</replaceable></option></term>
       <listitem>
        <para>
@@ -372,7 +372,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-partitions">
       <term><option>--partitions=<replaceable>NUM</replaceable></option></term>
       <listitem>
        <para>
@@ -384,7 +384,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-tablespace">
       <term><option>--tablespace=<replaceable>tablespace</replaceable></option></term>
       <listitem>
        <para>
@@ -394,7 +394,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-unlogged-tables">
       <term><option>--unlogged-tables</option></term>
       <listitem>
        <para>
@@ -416,7 +416,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
     benchmarking arguments:
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="pgbench-option-builtin">
       <term><option>-b</option> <replaceable>scriptname[@weight]</replaceable></term>
       <term><option>--builtin</option>=<replaceable>scriptname[@weight]</replaceable></term>
       <listitem>
@@ -437,7 +437,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-client">
       <term><option>-c</option> <replaceable>clients</replaceable></term>
       <term><option>--client=</option><replaceable>clients</replaceable></term>
       <listitem>
@@ -448,7 +448,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-connect">
       <term><option>-C</option></term>
       <term><option>--connect</option></term>
       <listitem>
@@ -460,7 +460,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-debug">
       <term><option>-d</option></term>
       <term><option>--debug</option></term>
       <listitem>
@@ -470,7 +470,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-define">
       <term><option>-D</option> <replaceable>varname</replaceable><literal>=</literal><replaceable>value</replaceable></term>
       <term><option>--define=</option><replaceable>varname</replaceable><literal>=</literal><replaceable>value</replaceable></term>
       <listitem>
@@ -481,7 +481,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-file">
       <term><option>-f</option> <replaceable>filename[@weight]</replaceable></term>
       <term><option>--file=</option><replaceable>filename[@weight]</replaceable></term>
       <listitem>
@@ -501,7 +501,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-jobs">
       <term><option>-j</option> <replaceable>threads</replaceable></term>
       <term><option>--jobs=</option><replaceable>threads</replaceable></term>
       <listitem>
@@ -514,7 +514,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-log">
       <term><option>-l</option></term>
       <term><option>--log</option></term>
       <listitem>
@@ -525,7 +525,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-latency-limit">
       <term><option>-L</option> <replaceable>limit</replaceable></term>
       <term><option>--latency-limit=</option><replaceable>limit</replaceable></term>
       <listitem>
@@ -554,7 +554,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
        </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-protocol">
       <term><option>-M</option> <replaceable>querymode</replaceable></term>
       <term><option>--protocol=</option><replaceable>querymode</replaceable></term>
       <listitem>
@@ -584,7 +584,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-no-vacuum-run">
       <term><option>-n</option></term>
       <term><option>--no-vacuum</option></term>
       <listitem>
@@ -599,7 +599,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-skip-some-updates">
       <term><option>-N</option></term>
       <term><option>--skip-some-updates</option></term>
       <listitem>
@@ -610,7 +610,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-progress">
       <term><option>-P</option> <replaceable>sec</replaceable></term>
       <term><option>--progress=</option><replaceable>sec</replaceable></term>
       <listitem>
@@ -629,7 +629,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-report-latencies">
       <term><option>-r</option></term>
       <term><option>--report-per-command</option></term>
       <listitem>
@@ -644,7 +644,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-rate">
       <term><option>-R</option> <replaceable>rate</replaceable></term>
       <term><option>--rate=</option><replaceable>rate</replaceable></term>
       <listitem>
@@ -695,7 +695,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-scale-run">
       <term><option>-s</option> <replaceable>scale_factor</replaceable></term>
       <term><option>--scale=</option><replaceable>scale_factor</replaceable></term>
       <listitem>
@@ -710,7 +710,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-select-only">
       <term><option>-S</option></term>
       <term><option>--select-only</option></term>
       <listitem>
@@ -721,7 +721,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-transactions">
       <term><option>-t</option> <replaceable>transactions</replaceable></term>
       <term><option>--transactions=</option><replaceable>transactions</replaceable></term>
       <listitem>
@@ -731,7 +731,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-time">
       <term><option>-T</option> <replaceable>seconds</replaceable></term>
       <term><option>--time=</option><replaceable>seconds</replaceable></term>
       <listitem>
@@ -743,7 +743,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-vacuum-all">
       <term><option>-v</option></term>
       <term><option>--vacuum-all</option></term>
       <listitem>
@@ -756,7 +756,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-aggregate-interval">
       <term><option>--aggregate-interval=<replaceable>seconds</replaceable></option></term>
       <listitem>
        <para>
@@ -767,7 +767,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-failures-detailed">
       <term><option>--failures-detailed</option></term>
       <listitem>
        <para>
@@ -786,7 +786,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-log-prefix">
       <term><option>--log-prefix=<replaceable>prefix</replaceable></option></term>
       <listitem>
        <para>
@@ -796,7 +796,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-max-tries">
       <term><option>--max-tries=<replaceable>number_of_tries</replaceable></option></term>
       <listitem>
        <para>
@@ -813,7 +813,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-progress-timestamp">
       <term><option>--progress-timestamp</option></term>
       <listitem>
        <para>
@@ -826,7 +826,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-random-seed">
       <term><option>--random-seed=</option><replaceable>seed</replaceable></term>
       <listitem>
        <para>
@@ -863,7 +863,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-sampling-rate">
       <term><option>--sampling-rate=<replaceable>rate</replaceable></option></term>
       <listitem>
        <para>
@@ -881,7 +881,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-show-script">
       <term><option>--show-script=</option><replaceable>scriptname</replaceable></term>
       <listitem>
        <para>
@@ -891,7 +891,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-verbose-errors">
       <term><option>--verbose-errors</option></term>
       <listitem>
        <para>
@@ -918,7 +918,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
 
     <variablelist>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-host">
       <term><option>-h</option> <replaceable>hostname</replaceable></term>
       <term><option>--host=</option><replaceable>hostname</replaceable></term>
       <listitem>
@@ -928,7 +928,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-port">
       <term><option>-p</option> <replaceable>port</replaceable></term>
       <term><option>--port=</option><replaceable>port</replaceable></term>
       <listitem>
@@ -938,7 +938,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-username">
       <term><option>-U</option> <replaceable>login</replaceable></term>
       <term><option>--username=</option><replaceable>login</replaceable></term>
       <listitem>
@@ -948,7 +948,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-version">
       <term><option>-V</option></term>
       <term><option>--version</option></term>
       <listitem>
@@ -958,7 +958,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="pgbench-option-help">
       <term><option>-?</option></term>
       <term><option>--help</option></term>
       <listitem>
@@ -992,7 +992,7 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
   <title>Environment</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="pgbench-environment-pgdatabase-et-al">
     <term><envar>PGDATABASE</envar></term>
     <term><envar>PGHOST</envar></term>
     <term><envar>PGPORT</envar></term>
@@ -1222,7 +1222,7 @@ SELECT 4 AS four \; SELECT 5 AS five \aset
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="pgbench-metacommand-if-else">
     <term><literal>\if</literal> <replaceable class="parameter">expression</replaceable></term>
     <term><literal>\elif</literal> <replaceable class="parameter">expression</replaceable></term>
     <term><literal>\else</literal></term>
@@ -1292,7 +1292,7 @@ SELECT 4 AS four \; SELECT 5 AS five \aset
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="pgbench-metacommand-sleep">
     <term>
      <literal>\sleep <replaceable>number</replaceable> [ us | ms | s ]</literal>
     </term>
@@ -1315,7 +1315,7 @@ SELECT 4 AS four \; SELECT 5 AS five \aset
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="pgbench-metacommand-setshell">
     <term>
      <literal>\setshell <replaceable>varname</replaceable> <replaceable>command</replaceable> [ <replaceable>argument</replaceable> ... ]</literal>
     </term>
@@ -1343,7 +1343,7 @@ SELECT 4 AS four \; SELECT 5 AS five \aset
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="pgbench-metacommand-shell">
     <term>
      <literal>\shell <replaceable>command</replaceable> [ <replaceable>argument</replaceable> ... ]</literal>
     </term>
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 8a5285da9a..74ec00e53b 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -49,7 +49,7 @@ PostgreSQL documentation
   <title>Options</title>
 
   <variablelist>
-    <varlistentry>
+    <varlistentry id="app-psql-option-echo-all">
       <term><option>-a</option></term>
       <term><option>--echo-all</option></term>
       <listitem>
@@ -62,7 +62,7 @@ PostgreSQL documentation
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-no-align">
       <term><option>-A</option></term>
       <term><option>--no-align</option></term>
       <listitem>
@@ -74,7 +74,7 @@ PostgreSQL documentation
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-echo-errors">
       <term><option>-b</option></term>
       <term><option>--echo-errors</option></term>
       <listitem>
@@ -86,7 +86,7 @@ PostgreSQL documentation
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-command">
       <term><option>-c <replaceable class="parameter">command</replaceable></option></term>
       <term><option>--command=<replaceable class="parameter">command</replaceable></option></term>
       <listitem>
@@ -143,7 +143,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-csv">
       <term><option>--csv</option></term>
       <listitem>
       <para>
@@ -153,7 +153,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-dbname">
       <term><option>-d <replaceable class="parameter">dbname</replaceable></option></term>
       <term><option>--dbname=<replaceable class="parameter">dbname</replaceable></option></term>
       <listitem>
@@ -169,7 +169,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-echo-queries">
       <term><option>-e</option></term>
       <term><option>--echo-queries</option></term>
       <listitem>
@@ -182,7 +182,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-echo-hidden">
       <term><option>-E</option></term>
       <term><option>--echo-hidden</option></term>
       <listitem>
@@ -195,7 +195,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-file">
       <term><option>-f <replaceable class="parameter">filename</replaceable></option></term>
       <term><option>--file=<replaceable class="parameter">filename</replaceable></option></term>
       <listitem>
@@ -237,7 +237,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-field-separator">
       <term><option>-F <replaceable class="parameter">separator</replaceable></option></term>
       <term><option>--field-separator=<replaceable class="parameter">separator</replaceable></option></term>
       <listitem>
@@ -249,7 +249,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-field-host">
       <term><option>-h <replaceable class="parameter">hostname</replaceable></option></term>
       <term><option>--host=<replaceable class="parameter">hostname</replaceable></option></term>
       <listitem>
@@ -262,7 +262,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-html">
       <term><option>-H</option></term>
       <term><option>--html</option></term>
       <listitem>
@@ -274,7 +274,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-list">
       <term><option>-l</option></term>
       <term><option>--list</option></term>
       <listitem>
@@ -294,7 +294,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-log-file">
       <term><option>-L <replaceable class="parameter">filename</replaceable></option></term>
       <term><option>--log-file=<replaceable class="parameter">filename</replaceable></option></term>
       <listitem>
@@ -306,7 +306,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-no-readline">
       <term><option>-n</option></term>
       <term><option>--no-readline</option></term>
       <listitem>
@@ -318,7 +318,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-output">
       <term><option>-o <replaceable class="parameter">filename</replaceable></option></term>
       <term><option>--output=<replaceable class="parameter">filename</replaceable></option></term>
       <listitem>
@@ -330,7 +330,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-port">
       <term><option>-p <replaceable class="parameter">port</replaceable></option></term>
       <term><option>--port=<replaceable class="parameter">port</replaceable></option></term>
       <listitem>
@@ -344,7 +344,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-pset">
       <term><option>-P <replaceable class="parameter">assignment</replaceable></option></term>
       <term><option>--pset=<replaceable class="parameter">assignment</replaceable></option></term>
       <listitem>
@@ -358,7 +358,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-quiet">
       <term><option>-q</option></term>
       <term><option>--quiet</option></term>
       <listitem>
@@ -373,7 +373,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-record-separator">
       <term><option>-R <replaceable class="parameter">separator</replaceable></option></term>
       <term><option>--record-separator=<replaceable class="parameter">separator</replaceable></option></term>
       <listitem>
@@ -385,7 +385,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-single-step">
       <term><option>-s</option></term>
       <term><option>--single-step</option></term>
       <listitem>
@@ -397,7 +397,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-single-line">
       <term><option>-S</option></term>
       <term><option>--single-line</option></term>
       <listitem>
@@ -417,7 +417,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-tuples-only">
       <term><option>-t</option></term>
       <term><option>--tuples-only</option></term>
       <listitem>
@@ -429,7 +429,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-table-attr">
       <term><option>-T <replaceable class="parameter">table_options</replaceable></option></term>
       <term><option>--table-attr=<replaceable class="parameter">table_options</replaceable></option></term>
       <listitem>
@@ -441,7 +441,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-username">
       <term><option>-U <replaceable class="parameter">username</replaceable></option></term>
       <term><option>--username=<replaceable class="parameter">username</replaceable></option></term>
       <listitem>
@@ -453,7 +453,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-variable">
       <term><option>-v <replaceable class="parameter">assignment</replaceable></option></term>
       <term><option>--set=<replaceable class="parameter">assignment</replaceable></option></term>
       <term><option>--variable=<replaceable class="parameter">assignment</replaceable></option></term>
@@ -470,7 +470,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-version">
       <term><option>-V</option></term>
       <term><option>--version</option></term>
       <listitem>
@@ -480,7 +480,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-no-password">
      <term><option>-w</option></term>
      <term><option>--no-password</option></term>
      <listitem>
@@ -500,7 +500,7 @@ EOF
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-password">
       <term><option>-W</option></term>
       <term><option>--password</option></term>
       <listitem>
@@ -528,7 +528,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-expanded">
       <term><option>-x</option></term>
       <term><option>--expanded</option></term>
       <listitem>
@@ -539,7 +539,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-no-psqlrc">
       <term><option>-X,</option></term>
       <term><option>--no-psqlrc</option></term>
       <listitem>
@@ -551,7 +551,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-field-separator-zero">
       <term><option>-z</option></term>
       <term><option>--field-separator-zero</option></term>
       <listitem>
@@ -562,7 +562,7 @@ EOF
       </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-record-separator-zero">
       <term><option>-0</option></term>
       <term><option>--record-separator-zero</option></term>
       <listitem>
@@ -574,7 +574,7 @@ EOF
       </listitem>
     </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="app-psql-option-single-transaction">
       <term><option>-1</option></term>
       <term><option>--single-transaction</option></term>
       <listitem>
@@ -602,7 +602,7 @@ EOF
       </listitem>
      </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="app-psql-option-help">
       <term><option>-?</option></term>
       <term><option>--help[=<replaceable class="parameter">topic</replaceable>]</option></term>
       <listitem>
@@ -868,7 +868,7 @@ testdb=&gt;
     The following meta-commands are defined:
 
     <variablelist>
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-a">
         <term><literal>\a</literal></term>
         <listitem>
         <para>
@@ -880,7 +880,7 @@ testdb=&gt;
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-bind">
        <term><literal>\bind</literal> [ <replaceable class="parameter">parameter</replaceable> ] ... </term>
 
        <listitem>
@@ -916,7 +916,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-c-lc">
         <term><literal>\c</literal> or <literal>\connect [ -reuse-previous=<replaceable class="parameter">on|off</replaceable> ] [ <replaceable class="parameter">dbname</replaceable> [ <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">host</replaceable> ] [ <replaceable class="parameter">port</replaceable> ] | <replaceable class="parameter">conninfo</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -996,7 +996,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-c-uc">
         <term><literal>\C [ <replaceable class="parameter">title</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -1011,7 +1011,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-cd">
        <term><literal>\cd [ <replaceable>directory</replaceable> ]</literal></term>
        <listitem>
         <para>
@@ -1028,7 +1028,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-conninfo">
         <term><literal>\conninfo</literal></term>
         <listitem>
         <para>
@@ -1125,7 +1125,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-copyright">
         <term><literal>\copyright</literal></term>
         <listitem>
         <para>
@@ -1209,7 +1209,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-d">
         <term><literal>\d[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
 
         <listitem>
@@ -1263,7 +1263,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-da-lc">
         <term><literal>\da[S] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
 
         <listitem>
@@ -1279,7 +1279,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-da-uc">
         <term><literal>\dA[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
 
         <listitem>
@@ -1293,7 +1293,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dac">
         <term>
           <literal>\dAc[+]
             [<link linkend="app-psql-patterns"><replaceable class="parameter">access-method-pattern</replaceable></link>
@@ -1316,7 +1316,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-daf">
         <term>
           <literal>\dAf[+]
             [<link linkend="app-psql-patterns"><replaceable class="parameter">access-method-pattern</replaceable></link>
@@ -1339,7 +1339,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dao">
         <term>
           <literal>\dAo[+]
             [<link linkend="app-psql-patterns"><replaceable class="parameter">access-method-pattern</replaceable></link>
@@ -1363,7 +1363,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dap">
         <term>
           <literal>\dAp[+]
             [<link linkend="app-psql-patterns"><replaceable class="parameter">access-method-pattern</replaceable></link>
@@ -1386,7 +1386,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-db">
         <term><literal>\db[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
 
         <listitem>
@@ -1402,7 +1402,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dc-lc">
         <term><literal>\dc[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1420,7 +1420,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dconfig">
         <term><literal>\dconfig[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1439,7 +1439,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dc-uc">
         <term><literal>\dC[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1454,7 +1454,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dd-lc">
         <term><literal>\dd[S] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1483,7 +1483,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dd-uc">
         <term><literal>\dD[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1500,7 +1500,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-ddp">
         <term><literal>\ddp [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1522,7 +1522,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-de-et-al">
         <term><literal>\dE[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <term><literal>\di[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <term><literal>\dm[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
@@ -1555,7 +1555,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-des">
         <term><literal>\des[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1571,7 +1571,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-det">
         <term><literal>\det[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1586,7 +1586,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-deu">
         <term><literal>\deu[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1609,7 +1609,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dew">
         <term><literal>\dew[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1625,7 +1625,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-df-lc">
         <term><literal>\df[anptwS+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> [ <replaceable class="parameter">arg_pattern</replaceable> ... ] ]</literal></term>
 
         <listitem>
@@ -1656,7 +1656,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-df-uc">
         <term><literal>\dF[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1670,7 +1670,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dfd">
         <term><literal>\dFd[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1684,7 +1684,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dfp">
         <term><literal>\dFp[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1698,7 +1698,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dft">
         <term><literal>\dFt[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1712,7 +1712,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dg">
         <term><literal>\dg[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1732,7 +1732,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dl-lc">
         <term><literal>\dl[+]</literal></term>
         <listitem>
         <para>
@@ -1745,7 +1745,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dl-uc">
         <term><literal>\dL[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1762,7 +1762,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dn">
         <term><literal>\dn[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
 
         <listitem>
@@ -1779,7 +1779,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-do-lc">
         <term><literal>\do[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> [ <replaceable class="parameter">arg_pattern</replaceable> [ <replaceable class="parameter">arg_pattern</replaceable> ] ] ]</literal></term>
         <listitem>
         <para>
@@ -1804,7 +1804,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-do-uc">
         <term><literal>\dO[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1824,7 +1824,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dp-lc">
         <term><literal>\dp [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1846,7 +1846,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dp-uc">
         <term><literal>\dP[itn+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1878,7 +1878,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-drds">
         <term><literal>\drds [ <link linkend="app-psql-patterns"><replaceable class="parameter">role-pattern</replaceable></link> [ <link linkend="app-psql-patterns"><replaceable class="parameter">database-pattern</replaceable></link> ] ]</literal></term>
         <listitem>
         <para>
@@ -1907,7 +1907,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-drp">
         <term><literal>\dRp[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1921,7 +1921,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-drs">
         <term><literal>\dRs[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1935,7 +1935,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dt">
         <term><literal>\dT[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1952,7 +1952,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-du">
         <term><literal>\du[S+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1971,7 +1971,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dx-lc">
         <term><literal>\dx[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1985,7 +1985,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dx-uc">
         <term><literal>\dX [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -2007,7 +2007,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-dy">
         <term><literal>\dy[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -2021,7 +2021,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-edit">
         <term><literal>\e</literal> or <literal>\edit</literal> <literal> <optional> <replaceable class="parameter">filename</replaceable> </optional> <optional> <replaceable class="parameter">line_number</replaceable> </optional> </literal></term>
 
         <listitem>
@@ -2074,7 +2074,7 @@ INSERT INTO tbl1 VALUES ($1, $2) \bind 'first value' 'second value' \g
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-echo">
         <term><literal>\echo <replaceable class="parameter">text</replaceable> [ ... ]</literal></term>
         <listitem>
         <para>
@@ -2099,7 +2099,7 @@ Tue Oct 26 21:40:57 CEST 1999
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-ef">
         <term><literal>\ef <optional> <replaceable class="parameter">function_description</replaceable> <optional>  <replaceable class="parameter">line_number</replaceable> </optional> </optional> </literal></term>
 
         <listitem>
@@ -2151,7 +2151,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-encoding">
         <term><literal>\encoding [ <replaceable class="parameter">encoding</replaceable> ]</literal></term>
 
         <listitem>
@@ -2163,7 +2163,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-errverbose">
         <term><literal>\errverbose</literal></term>
 
         <listitem>
@@ -2177,7 +2177,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-ev">
         <term><literal>\ev <optional> <replaceable class="parameter">view_name</replaceable> <optional>  <replaceable class="parameter">line_number</replaceable> </optional> </optional> </literal></term>
 
         <listitem>
@@ -2212,7 +2212,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-f">
         <term><literal>\f [ <replaceable class="parameter">string</replaceable> ]</literal></term>
 
         <listitem>
@@ -2225,7 +2225,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-g">
         <term><literal>\g [ (<replaceable class="parameter">option</replaceable>=<replaceable class="parameter">value</replaceable> [...]) ] [ <replaceable class="parameter">filename</replaceable> ]</literal></term>
         <term><literal>\g [ (<replaceable class="parameter">option</replaceable>=<replaceable class="parameter">value</replaceable> [...]) ] [ |<replaceable class="parameter">command</replaceable> ]</literal></term>
         <listitem>
@@ -2280,7 +2280,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gdesc">
         <term><literal>\gdesc</literal></term>
 
         <listitem>
@@ -2299,7 +2299,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-getenv">
         <term><literal>\getenv <replaceable class="parameter">psql_var</replaceable> <replaceable class="parameter">env_var</replaceable></literal></term>
 
         <listitem>
@@ -2321,7 +2321,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gexec">
         <term><literal>\gexec</literal></term>
 
         <listitem>
@@ -2367,7 +2367,7 @@ CREATE INDEX
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gset">
         <term><literal>\gset [ <replaceable class="parameter">prefix</replaceable> ]</literal></term>
 
         <listitem>
@@ -2412,7 +2412,7 @@ hello 10
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gx">
         <term><literal>\gx [ (<replaceable class="parameter">option</replaceable>=<replaceable class="parameter">value</replaceable> [...]) ] [ <replaceable class="parameter">filename</replaceable> ]</literal></term>
         <term><literal>\gx [ (<replaceable class="parameter">option</replaceable>=<replaceable class="parameter">value</replaceable> [...]) ] [ |<replaceable class="parameter">command</replaceable> ]</literal></term>
         <listitem>
@@ -2426,7 +2426,7 @@ hello 10
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-help">
         <term><literal>\h</literal> or <literal>\help</literal> <literal>[ <replaceable class="parameter">command</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -2457,7 +2457,7 @@ hello 10
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-html">
         <term><literal>\H</literal> or <literal>\html</literal></term>
         <listitem>
         <para>
@@ -2471,7 +2471,7 @@ hello 10
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-include">
         <term><literal>\i</literal> or <literal>\include</literal> <replaceable class="parameter">filename</replaceable></term>
         <listitem>
         <para>
@@ -2586,7 +2586,7 @@ SELECT
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-include_relative">
         <term><literal>\ir</literal> or <literal>\include_relative</literal> <replaceable class="parameter">filename</replaceable></term>
         <listitem>
         <para>
@@ -2601,7 +2601,7 @@ SELECT
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-list">
         <term><literal>\l[+]</literal> or <literal>\list[+] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -2618,7 +2618,7 @@ SELECT
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-lo_export">
         <term><literal>\lo_export <replaceable class="parameter">loid</replaceable> <replaceable class="parameter">filename</replaceable></literal></term>
 
         <listitem>
@@ -2642,7 +2642,7 @@ SELECT
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-lo_import">
         <term><literal>\lo_import <replaceable class="parameter">filename</replaceable> [ <replaceable class="parameter">comment</replaceable> ]</literal></term>
 
         <listitem>
@@ -2671,7 +2671,7 @@ lo_import 152801
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-lo_list">
         <term><literal>\lo_list[+]</literal></term>
         <listitem>
         <para>
@@ -2685,7 +2685,7 @@ lo_import 152801
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-lo_unlink">
         <term><literal>\lo_unlink <replaceable class="parameter">loid</replaceable></literal></term>
 
         <listitem>
@@ -2705,7 +2705,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-out">
         <term><literal>\o</literal> or <literal>\out [ <replaceable class="parameter">filename</replaceable> ]</literal></term>
         <term><literal>\o</literal> or <literal>\out [ |<replaceable class="parameter">command</replaceable> ]</literal></term>
         <listitem>
@@ -2744,7 +2744,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-print">
         <term><literal>\p</literal> or <literal>\print</literal></term>
         <listitem>
         <para>
@@ -2755,7 +2755,7 @@ lo_import 152801
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-password">
         <term><literal>\password [ <replaceable class="parameter">username</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -2768,7 +2768,7 @@ lo_import 152801
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-prompt">
         <term><literal>\prompt [ <replaceable class="parameter">text</replaceable> ] <replaceable class="parameter">name</replaceable></literal></term>
         <listitem>
         <para>
@@ -2787,7 +2787,7 @@ lo_import 152801
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-pset">
         <term><literal>\pset [ <replaceable class="parameter">option</replaceable> [ <replaceable class="parameter">value</replaceable> ] ]</literal></term>
 
         <listitem>
@@ -2812,7 +2812,7 @@ lo_import 152801
         <para>
         Adjustable printing options are:
         <variablelist>
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-border">
           <term><literal>border</literal></term>
           <listitem>
           <para>
@@ -2832,7 +2832,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-columns">
           <term><literal>columns</literal></term>
           <listitem>
           <para>
@@ -2851,7 +2851,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-csv_fieldsep">
           <term><literal>csv_fieldsep</literal></term>
           <listitem>
           <para>
@@ -2864,7 +2864,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-expanded">
           <term><literal>expanded</literal> (or <literal>x</literal>)</term>
           <listitem>
           <para>
@@ -2886,7 +2886,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-xheader_width">
           <term><literal>xheader_width</literal></term>
           <listitem>
           <para>
@@ -2919,7 +2919,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-fieldsep">
           <term><literal>fieldsep</literal></term>
           <listitem>
           <para>
@@ -2933,7 +2933,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-fieldsep_zero">
           <term><literal>fieldsep_zero</literal></term>
           <listitem>
           <para>
@@ -2943,7 +2943,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-footer">
           <term><literal>footer</literal></term>
           <listitem>
           <para>
@@ -2957,7 +2957,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-format">
           <term><literal>format</literal></term>
           <listitem>
           <para>
@@ -3034,7 +3034,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-linestyle">
           <term><literal>linestyle</literal></term>
           <listitem>
           <para>
@@ -3085,7 +3085,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-null">
           <term><literal>null</literal></term>
           <listitem>
           <para>
@@ -3097,7 +3097,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-numericlocale">
           <term><literal>numericlocale</literal></term>
           <listitem>
           <para>
@@ -3111,7 +3111,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-pager">
           <term><literal>pager</literal></term>
           <listitem>
           <para>
@@ -3146,7 +3146,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-pager_min_lines">
           <term><literal>pager_min_lines</literal></term>
           <listitem>
           <para>
@@ -3158,7 +3158,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-recordsep">
           <term><literal>recordsep</literal></term>
           <listitem>
           <para>
@@ -3168,7 +3168,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-recordsep_zero">
           <term><literal>recordsep_zero</literal></term>
           <listitem>
           <para>
@@ -3178,7 +3178,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-tableattr">
           <term><literal>tableattr</literal> (or <literal>T</literal>)</term>
           <listitem>
           <para>
@@ -3202,7 +3202,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-title">
           <term><literal>title</literal> (or <literal>C</literal>)</term>
           <listitem>
           <para>
@@ -3214,7 +3214,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-tuples_only">
           <term><literal>tuples_only</literal> (or <literal>t</literal>)</term>
           <listitem>
           <para>
@@ -3230,7 +3230,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-unicode_border_linestyle">
           <term><literal>unicode_border_linestyle</literal></term>
           <listitem>
           <para>
@@ -3241,7 +3241,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-unicode_column_linestyle">
           <term><literal>unicode_column_linestyle</literal></term>
           <listitem>
           <para>
@@ -3252,7 +3252,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-unicode_header_linestyle">
           <term><literal>unicode_header_linestyle</literal></term>
           <listitem>
           <para>
@@ -3283,7 +3283,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-quit">
         <term><literal>\q</literal> or <literal>\quit</literal></term>
         <listitem>
         <para>
@@ -3294,7 +3294,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-qecho">
         <term><literal>\qecho <replaceable class="parameter">text</replaceable> [ ... ] </literal></term>
         <listitem>
         <para>
@@ -3306,7 +3306,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-reset">
         <term><literal>\r</literal> or <literal>\reset</literal></term>
         <listitem>
         <para>
@@ -3316,7 +3316,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-s">
         <term><literal>\s [ <replaceable class="parameter">filename</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -3332,7 +3332,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-set">
         <term><literal>\set [ <replaceable class="parameter">name</replaceable> [ <replaceable class="parameter">value</replaceable> [ ... ] ] ]</literal></term>
 
         <listitem>
@@ -3372,7 +3372,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-setenv">
         <term><literal>\setenv <replaceable class="parameter">name</replaceable> [ <replaceable class="parameter">value</replaceable> ]</literal></term>
 
         <listitem>
@@ -3389,7 +3389,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-sf">
         <term><literal>\sf[+] <replaceable class="parameter">function_description</replaceable> </literal></term>
 
         <listitem>
@@ -3424,7 +3424,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-sv">
         <term><literal>\sv[+] <replaceable class="parameter">view_name</replaceable> </literal></term>
 
         <listitem>
@@ -3450,7 +3450,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-t-lc">
         <term><literal>\t</literal></term>
         <listitem>
         <para>
@@ -3462,7 +3462,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-t-uc">
         <term><literal>\T <replaceable class="parameter">table_options</replaceable></literal></term>
         <listitem>
         <para>
@@ -3476,7 +3476,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-timing">
        <term><literal>\timing [ <replaceable class="parameter">on</replaceable> | <replaceable class="parameter">off</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -3490,7 +3490,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-unset">
         <term><literal>\unset <replaceable class="parameter">name</replaceable></literal></term>
 
         <listitem>
@@ -3509,7 +3509,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-write">
         <term><literal>\w</literal> or <literal>\write</literal> <replaceable class="parameter">filename</replaceable></term>
         <term><literal>\w</literal> or <literal>\write</literal> <literal>|</literal><replaceable class="parameter">command</replaceable></term>
         <listitem>
@@ -3533,7 +3533,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-warn">
         <term><literal>\warn <replaceable class="parameter">text</replaceable> [ ... ]</literal></term>
         <listitem>
         <para>
@@ -3545,7 +3545,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-watch">
         <term><literal>\watch [ <replaceable class="parameter">seconds</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -3563,7 +3563,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-x">
         <term><literal>\x [ <replaceable class="parameter">on</replaceable> | <replaceable class="parameter">off</replaceable> | <replaceable class="parameter">auto</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -3574,7 +3574,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-z">
         <term><literal>\z [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -3593,7 +3593,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-exclamation_mark">
         <term><literal>\! [ <replaceable class="parameter">command</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -3613,7 +3613,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-question_mark">
         <term><literal>\? [ <replaceable class="parameter">topic</replaceable> ]</literal></term>
         <listitem>
         <para>
@@ -3630,7 +3630,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-semicolon">
         <term><literal>\;</literal></term>
         <listitem>
         <para>
@@ -3854,7 +3854,7 @@ bar
    </para>
 
     <variablelist>
-      <varlistentry>
+      <varlistentry id="app-psql-variables-autocommit">
       <term>
        <varname>AUTOCOMMIT</varname>
        <indexterm>
@@ -3898,7 +3898,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-comp_keyword_case">
         <term><varname>COMP_KEYWORD_CASE</varname></term>
         <listitem>
         <para>
@@ -3914,7 +3914,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-dbname">
         <term><varname>DBNAME</varname></term>
         <listitem>
         <para>
@@ -3925,7 +3925,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-echo">
         <term><varname>ECHO</varname></term>
         <listitem>
         <para>
@@ -3944,7 +3944,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-echo_hidden">
         <term><varname>ECHO_HIDDEN</varname></term>
         <listitem>
         <para>
@@ -3961,7 +3961,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-encoding">
         <term><varname>ENCODING</varname></term>
         <listitem>
         <para>
@@ -3973,7 +3973,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-error">
        <term><varname>ERROR</varname></term>
        <listitem>
         <para>
@@ -3983,7 +3983,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-fetch_count">
         <term><varname>FETCH_COUNT</varname></term>
         <listitem>
         <para>
@@ -4011,7 +4011,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-hide_tableam">
         <term><varname>HIDE_TABLEAM</varname></term>
         <listitem>
         <para>
@@ -4022,7 +4022,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-hide_toast_compression">
         <term><varname>HIDE_TOAST_COMPRESSION</varname></term>
         <listitem>
         <para>
@@ -4033,7 +4033,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-histcontrol">
         <term><varname>HISTCONTROL</varname></term>
         <listitem>
         <para>
@@ -4054,7 +4054,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-histfile">
         <term><varname>HISTFILE</varname></term>
         <listitem>
         <para>
@@ -4080,7 +4080,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-histsize">
         <term><varname>HISTSIZE</varname></term>
         <listitem>
         <para>
@@ -4096,7 +4096,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-host">
         <term><varname>HOST</varname></term>
         <listitem>
         <para>
@@ -4107,7 +4107,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-ignoreeof">
         <term><varname>IGNOREEOF</varname></term>
         <listitem>
         <para>
@@ -4128,7 +4128,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-lastoid">
         <term><varname>LASTOID</varname></term>
         <listitem>
         <para>
@@ -4144,7 +4144,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-last_error_message">
        <term><varname>LAST_ERROR_MESSAGE</varname></term>
        <term><varname>LAST_ERROR_SQLSTATE</varname></term>
        <listitem>
@@ -4157,7 +4157,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-on_error_rollback">
       <term>
        <varname>ON_ERROR_ROLLBACK</varname>
        <indexterm>
@@ -4181,7 +4181,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-on_error_stop">
         <term><varname>ON_ERROR_STOP</varname></term>
         <listitem>
         <para>
@@ -4200,7 +4200,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-port">
         <term><varname>PORT</varname></term>
         <listitem>
         <para>
@@ -4211,7 +4211,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-prompt">
         <term><varname>PROMPT1</varname></term>
         <term><varname>PROMPT2</varname></term>
         <term><varname>PROMPT3</varname></term>
@@ -4224,7 +4224,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-quiet">
         <term><varname>QUIET</varname></term>
         <listitem>
         <para>
@@ -4235,7 +4235,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-row_count">
        <term><varname>ROW_COUNT</varname></term>
        <listitem>
         <para>
@@ -4245,7 +4245,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-server_version_name">
         <term><varname>SERVER_VERSION_NAME</varname></term>
         <term><varname>SERVER_VERSION_NUM</varname></term>
         <listitem>
@@ -4260,7 +4260,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-show_all_results">
         <term><varname>SHOW_ALL_RESULTS</varname></term>
         <listitem>
         <para>
@@ -4272,7 +4272,7 @@ bar
         </listitem>
       </varlistentry>
 
-       <varlistentry>
+      <varlistentry id="app-psql-variables-show_context">
         <term><varname>SHOW_CONTEXT</varname></term>
         <listitem>
         <para>
@@ -4290,7 +4290,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-singleline">
         <term><varname>SINGLELINE</varname></term>
         <listitem>
         <para>
@@ -4300,7 +4300,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-singlestep">
         <term><varname>SINGLESTEP</varname></term>
         <listitem>
         <para>
@@ -4310,7 +4310,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-sqlstate">
        <term><varname>SQLSTATE</varname></term>
        <listitem>
         <para>
@@ -4321,7 +4321,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-user">
         <term><varname>USER</varname></term>
         <listitem>
         <para>
@@ -4332,7 +4332,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-verbosity">
         <term><varname>VERBOSITY</varname></term>
         <listitem>
         <para>
@@ -4346,7 +4346,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-version">
         <term><varname>VERSION</varname></term>
         <term><varname>VERSION_NAME</varname></term>
         <term><varname>VERSION_NUM</varname></term>
@@ -4475,7 +4475,7 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
     instead. Defined substitutions are:
 
     <variablelist>
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-m-uc">
         <term><literal>%M</literal></term>
         <listitem>
          <para>
@@ -4489,7 +4489,7 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-m-lc">
         <term><literal>%m</literal></term>
         <listitem>
          <para>
@@ -4500,12 +4500,12 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-gt">
         <term><literal>%&gt;</literal></term>
         <listitem><para>The port number at which the database server is listening.</para></listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-n">
         <term><literal>%n</literal></term>
         <listitem>
          <para>
@@ -4517,18 +4517,18 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-slash">
         <term><literal>%/</literal></term>
         <listitem><para>The name of the current database.</para></listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-tilde">
         <term><literal>%~</literal></term>
         <listitem><para>Like <literal>%/</literal>, but the output is <literal>~</literal>
          (tilde) if the database is your default database.</para></listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-numbersign">
         <term><literal>%#</literal></term>
         <listitem>
          <para>
@@ -4541,14 +4541,14 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-p">
         <term><literal>%p</literal></term>
         <listitem>
          <para>The process ID of the backend currently connected to.</para>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-r">
         <term><literal>%R</literal></term>
         <listitem>
         <para>
@@ -4571,7 +4571,7 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-x">
         <term><literal>%x</literal></term>
         <listitem>
         <para>
@@ -4584,7 +4584,7 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-l">
         <term><literal>%l</literal></term>
         <listitem>
          <para>
@@ -4593,7 +4593,7 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-digits">
         <term><literal>%</literal><replaceable class="parameter">digits</replaceable></term>
         <listitem>
         <para>
@@ -4602,7 +4602,7 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-name">
         <term><literal>%:</literal><replaceable class="parameter">name</replaceable><literal>:</literal></term>
         <listitem>
         <para>
@@ -4613,7 +4613,7 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-command">
         <term><literal>%`</literal><replaceable class="parameter">command</replaceable><literal>`</literal></term>
         <listitem>
         <para>
@@ -4624,7 +4624,7 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-square_brackets">
         <term><literal>%[</literal> ... <literal>%]</literal></term>
         <listitem>
          <para>
@@ -4646,7 +4646,7 @@ testdb=&gt; \set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-prompting-w">
         <term><literal>%w</literal></term>
         <listitem>
         <para>
@@ -4746,7 +4746,7 @@ $endif
 
   <variablelist>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-columns">
     <term><envar>COLUMNS</envar></term>
 
     <listitem>
@@ -4759,7 +4759,7 @@ $endif
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-pgdatabase-et-al">
     <term><envar>PGDATABASE</envar></term>
     <term><envar>PGHOST</envar></term>
     <term><envar>PGPORT</envar></term>
@@ -4772,7 +4772,7 @@ $endif
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-pg_color">
     <term><envar>PG_COLOR</envar></term>
     <listitem>
      <para>
@@ -4783,7 +4783,7 @@ $endif
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psql_editor-et-al">
     <term><envar>PSQL_EDITOR</envar></term>
     <term><envar>EDITOR</envar></term>
     <term><envar>VISUAL</envar></term>
@@ -4800,7 +4800,7 @@ $endif
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psql_editor_linenumber_arg">
     <term><envar>PSQL_EDITOR_LINENUMBER_ARG</envar></term>
 
     <listitem>
@@ -4828,7 +4828,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psql_history">
     <term><envar>PSQL_HISTORY</envar></term>
 
     <listitem>
@@ -4838,7 +4838,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-pager">
     <term><envar>PSQL_PAGER</envar></term>
     <term><envar>PAGER</envar></term>
 
@@ -4859,7 +4859,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psql_watch_pager">
     <term><envar>PSQL_WATCH_PAGER</envar></term>
 
     <listitem>
@@ -4877,7 +4877,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psqlrc">
     <term><envar>PSQLRC</envar></term>
 
     <listitem>
@@ -4887,7 +4887,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-shell">
     <term><envar>SHELL</envar></term>
 
     <listitem>
@@ -4897,7 +4897,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-tmpdir">
     <term><envar>TMPDIR</envar></term>
 
     <listitem>
@@ -4922,7 +4922,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
   <title>Files</title>
 
  <variablelist>
-  <varlistentry>
+  <varlistentry id="app-psql-files-psqlrc">
    <term><filename>psqlrc</filename> and <filename>~/.psqlrc</filename></term>
    <listitem>
     <para>
@@ -4970,7 +4970,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
    </listitem>
   </varlistentry>
 
-  <varlistentry>
+  <varlistentry id="app-psql-files-psql_history">
    <term><filename>.psql_history</filename></term>
    <listitem>
     <para>
diff --git a/doc/src/sgml/ref/rollback.sgml b/doc/src/sgml/ref/rollback.sgml
index 7700547669..79f508ebd7 100644
--- a/doc/src/sgml/ref/rollback.sgml
+++ b/doc/src/sgml/ref/rollback.sgml
@@ -42,7 +42,7 @@ ROLLBACK [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
   </indexterm>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-rollback-transaction">
     <term><literal>WORK</literal></term>
     <term><literal>TRANSACTION</literal></term>
     <listitem>
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 2eb27f71d8..117d097390 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -32,7 +32,7 @@
    interprocess communication and locking are working correctly.
   </para>
 
-  <sect2>
+  <sect2 id="regress-run-temp-inst">
    <title>Running the Tests Against a Temporary Installation</title>
 
   <para>
@@ -93,7 +93,7 @@ make MAX_CONNECTIONS=10 check
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="regress-run-existing-inst">
    <title>Running the Tests Against an Existing Installation</title>
 
   <para>
@@ -319,7 +319,7 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl'
   </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="regress-run-locale">
    <title>Locale and Encoding</title>
 
    <para>
@@ -362,7 +362,7 @@ make check LANG=C ENCODING=EUC_JP
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="regress-run-custom-settings">
    <title>Custom Server Settings</title>
 
    <para>
@@ -388,7 +388,7 @@ make check EXTRA_REGRESS_OPTS="--temp-config=test_postgresql.conf"
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="regress-run-extra-tests">
    <title>Extra Tests</title>
 
    <para>
@@ -452,7 +452,7 @@ make check EXTRA_TESTS=numeric_big
     <xref linkend="regress-variant"/> for details.
    </para>
 
-   <sect2>
+   <sect2 id="regress-evaluation-message-differences">
     <title>Error Message Differences</title>
 
     <para>
@@ -467,7 +467,7 @@ make check EXTRA_TESTS=numeric_big
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="regress-evaluation-locale-differences">
     <title>Locale Differences</title>
 
     <para>
@@ -514,7 +514,7 @@ make check NO_LOCALE=1
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="regress-evaluation-date-time-differences">
     <title>Date and Time Differences</title>
 
     <para>
@@ -528,7 +528,7 @@ make check NO_LOCALE=1
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="regress-evaluation-float-differences">
     <title>Floating-Point Differences</title>
 
     <para>
@@ -556,7 +556,7 @@ make check NO_LOCALE=1
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="regress-evaluation-ordering-differences">
     <title>Row Ordering Differences</title>
 
     <para>
@@ -592,7 +592,7 @@ exclusion of those that don't.
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="regress-evaluation-stack-depth">
     <title>Insufficient Stack Depth</title>
 
     <para>
@@ -614,7 +614,7 @@ exclusion of those that don't.
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="regress-evaluation-random-test">
     <title>The <quote>random</quote> Test</title>
 
     <para>
@@ -629,7 +629,7 @@ diff results/random.out expected/random.out
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="regress-evaluation-config-params">
     <title>Configuration Parameters</title>
 
     <para>
diff --git a/doc/src/sgml/rowtypes.sgml b/doc/src/sgml/rowtypes.sgml
index 417ccb00de..4d86f97c03 100644
--- a/doc/src/sgml/rowtypes.sgml
+++ b/doc/src/sgml/rowtypes.sgml
@@ -91,7 +91,7 @@ CREATE TABLE inventory_item (
  </para>
  </sect2>
 
- <sect2>
+ <sect2 id="rowtypes-constructing">
   <title>Constructing Composite Values</title>
 
   <indexterm>
@@ -209,7 +209,7 @@ SELECT (my_func(...)).field FROM ...
  </para>
  </sect2>
 
- <sect2>
+ <sect2 id="rowtypes-modifying">
   <title>Modifying Composite Types</title>
 
  <para>
diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml
index 3c9459b648..d229b94d39 100644
--- a/doc/src/sgml/rules.sgml
+++ b/doc/src/sgml/rules.sgml
@@ -643,7 +643,7 @@ SELECT shoe_ready.shoename, shoe_ready.sh_avail,
    </para>
 </sect2>
 
-<sect2>
+<sect2 id="rules-views-non-select">
 <title>View Rules in Non-<command>SELECT</command> Statements</title>
 
 <para>
@@ -763,7 +763,7 @@ SELECT t1.a, t2.b, t1.ctid FROM t1, t2 WHERE t1.a = t2.a;
 </para>
 </sect2>
 
-<sect2>
+<sect2 id="rules-views-power">
 <title>The Power of Views in <productname>PostgreSQL</productname></title>
 
 <para>
@@ -1178,7 +1178,7 @@ SELECT word FROM words ORDER BY word &lt;-&gt; 'caterpiler' LIMIT 10;
  </para>
 </caution>
 
-<sect2>
+<sect2 id="rules-update-how">
 <title>How Update Rules Work</title>
 
 <para>
@@ -1302,7 +1302,7 @@ CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS
     there is no need to apply update rules to the output of view rewriting.
 </para>
 
-<sect3>
+<sect3 id="rules-update-how-first">
 <title>A First Rule Step by Step</title>
 
 <para>
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index bb51cab3ea..9e87e07dfe 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -1220,7 +1220,7 @@ RemoveIPC=no
    </caution>
   </sect2>
 
-  <sect2>
+  <sect2 id="kernel-resources-limits">
    <title>Resource Limits</title>
 
    <para>
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index 9be69e3609..72387c7d45 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -20,7 +20,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="seg-rationale">
   <title>Rationale</title>
 
   <para>
@@ -81,7 +81,7 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH";
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="seg-syntax">
   <title>Syntax</title>
 
   <para>
@@ -220,7 +220,7 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH";
 
  </sect2>
 
- <sect2>
+ <sect2 id="seg-precision">
   <title>Precision</title>
 
   <para>
@@ -239,7 +239,7 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH";
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="seg-usage">
   <title>Usage</title>
 
   <para>
@@ -363,7 +363,7 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH";
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="seg-notes">
   <title>Notes</title>
 
   <para>
@@ -392,7 +392,7 @@ postgres=&gt; select '10(+-)1'::seg as seg;
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="seg-credits">
   <title>Credits</title>
 
   <para>
diff --git a/doc/src/sgml/sepgsql.sgml b/doc/src/sgml/sepgsql.sgml
index 620d0636e8..fd4bb83cbf 100644
--- a/doc/src/sgml/sepgsql.sgml
+++ b/doc/src/sgml/sepgsql.sgml
@@ -315,7 +315,7 @@ $ sudo semodule -r sepgsql-regtest
 
  <sect2 id="sepgsql-features">
   <title>Features</title>
-  <sect3>
+  <sect3 id="sepgsql-features-controlled-obj-classes">
    <title>Controlled Object Classes</title>
    <para>
     The security model of <productname>SELinux</productname> describes all the access
@@ -348,7 +348,7 @@ $ sudo semodule -r sepgsql-regtest
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="sepgsql-features-dml-permissions">
    <title>DML Permissions</title>
 
    <para>
@@ -432,7 +432,7 @@ UPDATE t1 SET x = 2, y = func1(y) WHERE z = 100;
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="sepgsql-features-ddl-permissions">
    <title>DDL Permissions</title>
    <para>
     <productname>SELinux</productname> defines several permissions to control common
@@ -523,7 +523,7 @@ UPDATE t1 SET x = 2, y = func1(y) WHERE z = 100;
 
   </sect3>
 
-  <sect3>
+  <sect3 id="sepgsql-features-trusted-procedures">
    <title>Trusted Procedures</title>
    <para>
     Trusted procedures are similar to security definer functions or setuid
@@ -579,7 +579,7 @@ postgres=# SELECT cid, cname, show_credit(cid) FROM customer;
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="sepgsql-features-dynamic-domain-transitions">
    <title>Dynamic Domain Transitions</title>
    <para>
     It is possible to use SELinux's dynamic domain transition feature
@@ -641,7 +641,7 @@ ERROR:  SELinux: security policy violation
    </para>
   </sect3>
 
-  <sect3>
+  <sect3 id="sepgsql-features-misc">
    <title>Miscellaneous</title>
    <para>
     We reject the <link linkend="sql-load"><command>LOAD</command></link> command across the board, because
diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml
index 5186d75d61..4383ccc34d 100644
--- a/doc/src/sgml/sources.sgml
+++ b/doc/src/sgml/sources.sgml
@@ -445,7 +445,7 @@ ereport(level, errmsg_internal("format string", ...));
     <productname>PostgreSQL</productname>.
    </para>
 
-  <simplesect>
+  <simplesect id="error-style-guide-what-goes-where">
    <title>What Goes Where</title>
 
    <para>
@@ -486,7 +486,7 @@ Hint:       the addendum
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-formatting">
    <title>Formatting</title>
 
    <para>
@@ -507,7 +507,7 @@ Hint:       the addendum
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-quotation-marks">
    <title>Quotation Marks</title>
 
    <para>
@@ -528,7 +528,7 @@ Hint:       the addendum
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-quotes">
    <title>Use of Quotes</title>
 
    <para>
@@ -552,7 +552,7 @@ Hint:       the addendum
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-grammar-punctuation">
    <title>Grammar and Punctuation</title>
 
    <para>
@@ -591,7 +591,7 @@ Hint:       the addendum
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-case">
    <title>Upper Case vs. Lower Case</title>
 
    <para>
@@ -607,7 +607,7 @@ Hint:       the addendum
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-passive-voice">
    <title>Avoid Passive Voice</title>
 
    <para>
@@ -623,7 +623,7 @@ Hint:       the addendum
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-tense">
    <title>Present vs. Past Tense</title>
 
    <para>
@@ -663,7 +663,7 @@ cannot open file "%s"
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-object-type">
    <title>Type of the Object</title>
 
    <para>
@@ -677,7 +677,7 @@ cannot open file "%s"
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-brackets">
    <title>Brackets</title>
 
    <para>
@@ -692,7 +692,7 @@ cannot open file "%s"
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-error-messages">
    <title>Assembling Error Messages</title>
 
    <para>
@@ -713,7 +713,7 @@ could not open file %s: %m
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-error-reasons">
    <title>Reasons for Errors</title>
 
    <para>
@@ -728,7 +728,7 @@ BETTER: could not open file %s (I/O failure)
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-function-names">
    <title>Function Names</title>
 
    <para>
@@ -760,7 +760,7 @@ BETTER: could not open file %s: %m
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-tricky-words">
    <title>Tricky Words to Avoid</title>
 
   <formalpara>
@@ -846,7 +846,7 @@ BETTER: unrecognized node type: 42
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-spelling">
    <title>Proper Spelling</title>
 
    <para>
@@ -886,7 +886,7 @@ BETTER: unrecognized node type: 42
 
   </simplesect>
 
-  <simplesect>
+  <simplesect id="error-style-guide-localization">
    <title>Localization</title>
 
    <para>
@@ -901,7 +901,7 @@ BETTER: unrecognized node type: 42
   <sect1 id="source-conventions">
    <title>Miscellaneous Coding Conventions</title>
 
-   <simplesect>
+   <simplesect id="source-conventions-c-standard">
     <title>C Standard</title>
     <para>
      Code in <productname>PostgreSQL</productname> should only rely on language
@@ -932,7 +932,7 @@ BETTER: unrecognized node type: 42
     </para>
    </simplesect>
 
-   <simplesect>
+   <simplesect id="source-conventions-macros-inline">
     <title>Function-Like Macros and Inline Functions</title>
     <para>
      Both, macros with arguments and <literal>static inline</literal>
@@ -971,7 +971,7 @@ MemoryContextSwitchTo(MemoryContext context)
     </para>
    </simplesect>
 
-   <simplesect>
+   <simplesect id="source-conventions-signal-handlers">
     <title>Writing Signal Handlers</title>
     <para>
      To be suitable to run inside a signal handler code has to be
@@ -1013,7 +1013,7 @@ handle_sighup(SIGNAL_ARGS)
     </para>
    </simplesect>
 
-   <simplesect>
+   <simplesect id="source-conventions-function-pointers">
     <title>Calling Function Pointers</title>
 
     <para>
diff --git a/doc/src/sgml/sslinfo.sgml b/doc/src/sgml/sslinfo.sgml
index 2a9c45a111..786f113072 100644
--- a/doc/src/sgml/sslinfo.sgml
+++ b/doc/src/sgml/sslinfo.sgml
@@ -25,7 +25,7 @@
   configured with <literal>--with-ssl=openssl</literal>.
  </para>
 
- <sect2>
+ <sect2 id="sslinfo-functions">
   <title>Functions Provided</title>
 
   <variablelist>
@@ -243,7 +243,7 @@ emailAddress
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="sslinfo-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/tablefunc.sgml b/doc/src/sgml/tablefunc.sgml
index 808162b89b..acc9236a48 100644
--- a/doc/src/sgml/tablefunc.sgml
+++ b/doc/src/sgml/tablefunc.sgml
@@ -20,7 +20,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="tablefunc-functions-sect">
   <title>Functions Provided</title>
 
   <para>
@@ -119,7 +119,7 @@
     </tgroup>
   </table>
 
-  <sect3>
+  <sect3 id="tablefunc-functions-normal_rand">
    <title><function>normal_rand</function></title>
 
    <indexterm>
@@ -166,7 +166,7 @@ test=# SELECT * FROM normal_rand(1000, 5, 3);
 </screen>
   </sect3>
 
-  <sect3>
+  <sect3 id="tablefunc-functions-crosstab-text">
    <title><function>crosstab(text)</function></title>
 
    <indexterm>
@@ -325,7 +325,7 @@ AS ct(row_name text, category_1 text, category_2 text, category_3 text);
 
   </sect3>
 
-  <sect3>
+  <sect3 id="tablefunc-functions-crosstab-n-text">
    <title><function>crosstab<replaceable>N</replaceable>(text)</function></title>
 
    <indexterm>
@@ -436,7 +436,7 @@ CREATE OR REPLACE FUNCTION crosstab_float8_5_cols(
 
   </sect3>
 
-  <sect3>
+  <sect3 id="tablefunc-functions-crosstab-text-2">
    <title><function>crosstab(text, text)</function></title>
 
    <indexterm>
@@ -646,7 +646,7 @@ AS
 
   </sect3>
 
-  <sect3>
+  <sect3 id="tablefunc-functions-connectby">
    <title><function>connectby</function></title>
 
    <indexterm>
@@ -853,7 +853,7 @@ SELECT * FROM connectby('connectby_tree', 'keyid', 'parent_keyid', 'pos', 'row2'
 
  </sect2>
 
- <sect2>
+ <sect2 id="tablefunc-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/tsm-system-rows.sgml b/doc/src/sgml/tsm-system-rows.sgml
index d960aa3e0f..f5357791c0 100644
--- a/doc/src/sgml/tsm-system-rows.sgml
+++ b/doc/src/sgml/tsm-system-rows.sgml
@@ -39,7 +39,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="tsm-system-rows-examples">
   <title>Examples</title>
 
   <para>
diff --git a/doc/src/sgml/tsm-system-time.sgml b/doc/src/sgml/tsm-system-time.sgml
index df6e83a923..0de15ae7e8 100644
--- a/doc/src/sgml/tsm-system-time.sgml
+++ b/doc/src/sgml/tsm-system-time.sgml
@@ -41,7 +41,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="tsm-system-time-examples">
   <title>Examples</title>
 
   <para>
diff --git a/doc/src/sgml/unaccent.sgml b/doc/src/sgml/unaccent.sgml
index 5cd716a2aa..139a87d4ff 100644
--- a/doc/src/sgml/unaccent.sgml
+++ b/doc/src/sgml/unaccent.sgml
@@ -27,7 +27,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="unaccent-configuration">
   <title>Configuration</title>
 
   <para>
@@ -107,7 +107,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="unaccent-usage">
   <title>Usage</title>
 
   <para>
@@ -165,7 +165,7 @@ mydb=# select ts_headline('fr','H&ocirc;tel de la Mer',to_tsquery('fr','Hotels')
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="unaccent-functions">
  <title>Functions</title>
 
  <para>
diff --git a/doc/src/sgml/uuid-ossp.sgml b/doc/src/sgml/uuid-ossp.sgml
index 26bfb908da..0a42d516e8 100644
--- a/doc/src/sgml/uuid-ossp.sgml
+++ b/doc/src/sgml/uuid-ossp.sgml
@@ -22,7 +22,7 @@
   on the current database.
  </para>
 
- <sect2>
+ <sect2 id="uuid-ossp-functions-sect">
   <title><literal>uuid-ossp</literal> Functions</title>
 
   <para>
@@ -205,7 +205,7 @@ SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org');
   </table>
  </sect2>
 
- <sect2>
+ <sect2 id="uuid-ossp-building">
   <title>Building <filename>uuid-ossp</filename></title>
 
   <para>
@@ -230,7 +230,7 @@ SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org');
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="uuid-ossp-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index cf5810b3c1..c19131b399 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -1464,7 +1464,7 @@ SELECT concat_values('|', 1, 4, 2);
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="xfunc-sql-collations">
     <title><acronym>SQL</acronym> Functions with Collations</title>
 
     <indexterm>
@@ -2343,7 +2343,7 @@ memcpy(destination->data, buffer, 40);
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="xfunc-c-v1-call-conv">
     <title>Version 1 Calling Conventions</title>
 
     <para>
@@ -2593,7 +2593,7 @@ CREATE FUNCTION concat_text(text, text) RETURNS text
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="xfunc-c-code">
     <title>Writing Code</title>
 
     <para>
@@ -2700,7 +2700,7 @@ CREATE FUNCTION concat_text(text, text) RETURNS text
 
 &dfunc;
 
-   <sect2>
+   <sect2 id="xfunc-c-composite-type-args">
     <title>Composite-Type Arguments</title>
 
     <para>
@@ -2788,7 +2788,7 @@ CREATE FUNCTION c_overpaid(emp, integer) RETURNS boolean
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="xfunc-c-returning-rows">
     <title>Returning Rows (Composite Types)</title>
 
     <para>
@@ -3283,7 +3283,7 @@ CREATE OR REPLACE FUNCTION retcomposite(IN integer, IN integer,
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="xfunc-c-polymorphic">
     <title>Polymorphic Arguments and Return Types</title>
 
     <para>
diff --git a/doc/src/sgml/xml2.sgml b/doc/src/sgml/xml2.sgml
index 47650d9dfd..1ce2070eae 100644
--- a/doc/src/sgml/xml2.sgml
+++ b/doc/src/sgml/xml2.sgml
@@ -12,7 +12,7 @@
   XSLT functionality.
  </para>
 
- <sect2>
+ <sect2 id="xml2-deprecation">
   <title>Deprecation Notice</title>
 
   <para>
@@ -30,7 +30,7 @@
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="xml2-functions">
   <title>Description of Functions</title>
 
   <para>
@@ -168,7 +168,7 @@
   </table>
  </sect2>
 
- <sect2>
+ <sect2 id="xml2-xpath_table-">
   <title><literal>xpath_table</literal></title>
 
   <indexterm>
@@ -318,7 +318,7 @@ WHERE t.author_id = p.person_id;
    of this in a view for convenience.
   </para>
 
-  <sect3>
+  <sect3 id="xml2-xpath_table-multivalued-results">
    <title>Multivalued Results</title>
 
    <para>
@@ -393,14 +393,14 @@ ORDER BY doc_num, line_num;
   </sect3>
  </sect2>
 
- <sect2>
+ <sect2 id="xml2-xslt">
   <title>XSLT Functions</title>
 
   <para>
    The following functions are available if libxslt is installed:
   </para>
 
-  <sect3>
+  <sect3 id="xml2-xslt-xslt_process">
    <title><literal>xslt_process</literal></title>
 
   <indexterm>
@@ -427,7 +427,7 @@ xslt_process(text document, text stylesheet, text paramlist) returns text
   </sect3>
  </sect2>
 
- <sect2>
+ <sect2 id="xml2-author">
   <title>Author</title>
 
   <para>
diff --git a/doc/src/sgml/xoper.sgml b/doc/src/sgml/xoper.sgml
index 98f4c5c4aa..a929ced07d 100644
--- a/doc/src/sgml/xoper.sgml
+++ b/doc/src/sgml/xoper.sgml
@@ -109,7 +109,7 @@ SELECT (a + b) AS c FROM test_complex;
     See <xref linkend="xfunc-optimization"/> for more information.
    </para>
 
-   <sect2>
+   <sect2 id="xoper-commutator">
     <title><literal>COMMUTATOR</literal></title>
 
     <para>
@@ -186,7 +186,7 @@ SELECT (a + b) AS c FROM test_complex;
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="xoper-negator">
     <title><literal>NEGATOR</literal></title>
 
     <para>
@@ -225,7 +225,7 @@ SELECT (a + b) AS c FROM test_complex;
 
   </sect2>
 
-  <sect2>
+  <sect2 id="xoper-restrict">
    <title><literal>RESTRICT</literal></title>
 
    <para>
@@ -302,7 +302,7 @@ column OP constant
    </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="xoper-join">
     <title><literal>JOIN</literal></title>
 
     <para>
@@ -339,7 +339,7 @@ table1.column1 OP table2.column2
     </para>
    </sect2>
 
-   <sect2>
+   <sect2 id="xoper-hashes">
     <title><literal>HASHES</literal></title>
 
     <para>
@@ -427,7 +427,7 @@ table1.column1 OP table2.column2
 
    </sect2>
 
-   <sect2>
+   <sect2 id="xoper-merges">
     <title><literal>MERGES</literal></title>
 
     <para>
