doc: add missing "id" attributes to extension packaging page

Started by Ian Lawrence Barwickabout 3 years ago83 messages
#1Ian Lawrence Barwick
barwick@gmail.com
1 attachment(s)

Hi

On this page:

https://www.postgresql.org/docs/current/extend-extensions.html

three of the <sect2> sections are missing an "id" attribute; patch adds
these. Noticed when trying to create a stable link to one of the affected
sections.

Regards

Ian Barwick

Attachments:

v1-0001-doc-add-id-attributes-to-extension-documentation.patchtext/x-patch; charset=US-ASCII; name=v1-0001-doc-add-id-attributes-to-extension-documentation.patchDownload
From c0dec489ec5b088d7e16b814aef9750ff271c606 Mon Sep 17 00:00:00 2001
From: Ian Barwick <barwick@gmail.com>
Date: Mon, 5 Dec 2022 10:41:05 +0900
Subject: [PATCH v1] doc: add "id" attributes to extension documentation

Some of the sections here:

  https://www.postgresql.org/docs/current/extend-extensions.html

were missing "id" attributes.
---
 doc/src/sgml/extend.sgml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml
index 46e873a166..ba89cf5a28 100644
--- a/doc/src/sgml/extend.sgml
+++ b/doc/src/sgml/extend.sgml
@@ -628,7 +628,7 @@ RETURNS anycompatible AS ...
     dropping the whole extension.
    </para>
 
-   <sect2>
+   <sect2 id="extend-extensions-files">
     <title>Extension Files</title>
 
    <indexterm>
@@ -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>

base-commit: 71cb84ec69a38444c48bd8d3b5451b2da157848b
-- 
2.31.1

#2Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Ian Lawrence Barwick (#1)
Re: doc: add missing "id" attributes to extension packaging page

On 2022-Dec-05, Ian Lawrence Barwick wrote:

On this page:

https://www.postgresql.org/docs/current/extend-extensions.html

three of the <sect2> sections are missing an "id" attribute; patch adds
these. Noticed when trying to create a stable link to one of the affected
sections.

Hm, I was reminded of this patch here that adds IDs in a lot of places
/messages/by-id/3bac458c-b121-1b20-8dea-0665986faa40@gmx.de
and this other one
/messages/by-id/76287ac6-f415-8562-fdaa-5876380c05f3@gmx.de
which adds XSL stuff for adding selectable anchors next to each
id-carrying item.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

#3Ian Lawrence Barwick
barwick@gmail.com
In reply to: Alvaro Herrera (#2)
Re: doc: add missing "id" attributes to extension packaging page

2022年12月5日(月) 18:56 Alvaro Herrera <alvherre@alvh.no-ip.org>:

On 2022-Dec-05, Ian Lawrence Barwick wrote:

On this page:

https://www.postgresql.org/docs/current/extend-extensions.html

three of the <sect2> sections are missing an "id" attribute; patch adds
these. Noticed when trying to create a stable link to one of the affected
sections.

Hm, I was reminded of this patch here that adds IDs in a lot of places
/messages/by-id/3bac458c-b121-1b20-8dea-0665986faa40@gmx.de
and this other one
/messages/by-id/76287ac6-f415-8562-fdaa-5876380c05f3@gmx.de
which adds XSL stuff for adding selectable anchors next to each
id-carrying item.

Oh, now you mention it, I vaguely recall seeing those. However the thread
stalled back in March and the patches don't seem to have made it to a
CommitFest entry. Brar, would you like to add an entry so they don't get
lost? See: https://commitfest.postgresql.org/41/

The items in my patch are covered by the above so disregard that.

Regards

Ian Barwick

#4Brar Piening
brar@gmx.de
In reply to: Ian Lawrence Barwick (#3)
Re: doc: add missing "id" attributes to extension packaging page

On 06.12.2022 at 01:55, Ian Lawrence Barwick wrote:

Oh, now you mention it, I vaguely recall seeing those. However the thread
stalled back in March and the patches don't seem to have made it to a
CommitFest entry.

Yes, my patches added quite a few ids and also some xsl/css logic to
make them more discoverable in the browser but I had gotten the
impression that nobody besides me cares about this, so I didn't push it
any further.

Brar, would you like to add an entry so they don't get
lost? See: https://commitfest.postgresql.org/41/

Yes. I can certainly add them to the commitfest although I'm not sure if
they still apply cleanly.

I can also rebase or extend them if somebody cares.

Regards,

Brar

#5Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Brar Piening (#4)
Re: doc: add missing "id" attributes to extension packaging page

On 2022-Dec-06, Brar Piening wrote:

On 06.12.2022 at 01:55, Ian Lawrence Barwick wrote:

Oh, now you mention it, I vaguely recall seeing those. However the thread
stalled back in March and the patches don't seem to have made it to a
CommitFest entry.

Yes, my patches added quite a few ids and also some xsl/css logic to
make them more discoverable in the browser but I had gotten the
impression that nobody besides me cares about this, so I didn't push it
any further.

I care. The problem last time is that we were in the middle of the last
commitfest, so we were (or at least I was) distracted by other stuff.

Looking at the resulting psql page,
https://pgdocs.piening.info/app-psql.html#APP-PSQL-OPTIONS-EXPANDED
I note that the ID for the -x option is called "options-blah". I
understand where does this come from: it's the "expanded" bit in the
"options" section. However, put together it's a bit silly to have
"options" in plural there; it would make more sense to have it be
https://pgdocs.piening.info/app-psql.html#APP-PSQL-OPTION-EXPANDED
(where you can read more naturally "the expanded option for psql").
How laborious would it be to make it so?

Yes. I can certainly add them to the commitfest although I'm not sure if
they still apply cleanly.

It'll probably have some conflicts, yeah.

I can also rebase or extend them if somebody cares.

I would welcome separate patches: one to add the IDs, another for the
XSL/CSS stuff. That allows us to discuss them separately.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/

#6Brar Piening
brar@gmx.de
In reply to: Alvaro Herrera (#5)
Re: doc: add missing "id" attributes to extension packaging page

On 06.12.2022 at 09:38, Alvaro Herrera wrote:

I care. The problem last time is that we were in the middle of the last
commitfest, so we were (or at least I was) distracted by other stuff.

Ok, thanks. That's appreciated and understood.

Looking at the resulting psql page,
https://pgdocs.piening.info/app-psql.html#APP-PSQL-OPTIONS-EXPANDED
I note that the ID for the -x option is called "options-blah". I
understand where does this come from: it's the "expanded" bit in the
"options" section. However, put together it's a bit silly to have
"options" in plural there; it would make more sense to have it be
https://pgdocs.piening.info/app-psql.html#APP-PSQL-OPTION-EXPANDED
(where you can read more naturally "the expanded option for psql").
How laborious would it be to make it so?

No problem. I've already done it. Your second link should work now.

It'll probably have some conflicts, yeah.

I've updated  and rebased my branch on current master now.

I would welcome separate patches: one to add the IDs, another for the
XSL/CSS stuff. That allows us to discuss them separately.

I'll send two patches in two separate e-mails in a moment.

Regards,

Brar

#7Brar Piening
brar@gmx.de
In reply to: Brar Piening (#6)
1 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On 06.12.2022 at 18:59, Brar Piening wrote:

On 06.12.2022 at 09:38, Alvaro Herrera wrote:

I would welcome separate patches: one to add the IDs, another for the
XSL/CSS stuff.  That allows us to discuss them separately.

I'll send two patches in two separate e-mails in a moment.

This is patch no 1 that adds ids to various elements without making them
visible on the HTML surface.
It is an updated and rebased version of the work discussed in the
following thread:

/messages/by-id/f900c5e1-a18a-84cc-6536-e85ec655c7d7@gmx.de

The current statistics for docbook elements with/without ids after
applying the patch are the following:

name | with_id | without_id | id_coverage | min_id_len | max_id_len
---------------+---------+------------+-------------+------------+------------
sect2 | 870 | 0 | 100.00 | 7 | 57 sect1 | 739 | 0 | 100.00 | 4 | 46
refentry | 307 | 0 | 100.00 | 8 | 37 sect3 | 206 | 0 | 100.00 | 11 | 57
chapter | 77 | 0 | 100.00 | 5 | 24 sect4 | 28 | 0 | 100.00 | 16 | 47
biblioentry | 23 | 0 | 100.00 | 6 | 15 simplesect | 20 | 0 | 100.00 | 24
| 39 appendix | 15 | 0 | 100.00 | 7 | 23 part | 8 | 0 | 100.00 | 5 | 20
co | 4 | 0 | 100.00 | 18 | 30 figure | 3 | 0 | 100.00 | 13 | 28
reference | 3 | 0 | 100.00 | 14 | 18 anchor | 1 | 0 | 100.00 | 21 | 21
bibliography | 1 | 0 | 100.00 | 8 | 8 book | 1 | 0 | 100.00 | 10 | 10
index | 1 | 0 | 100.00 | 11 | 11 legalnotice | 1 | 0 | 100.00 | 13 | 13
preface | 1 | 0 | 100.00 | 9 | 9 glossentry | 119 | 14 | 89.47 | 13 | 32
table | 285 | 162 | 63.76 | 12 | 56 example | 27 | 16 | 62.79 | 12 | 42
refsect3 | 5 | 3 | 62.50 | 19 | 24 refsect2 | 41 | 56 | 42.27 | 10 | 36
varlistentry | 1701 | 3172 | 34.91 | 9 | 64 footnote | 5 | 18 | 21.74 |
17 | 32 step | 28 | 130 | 17.72 | 7 | 28 refsect1 | 151 | 1333 | 10.18 |
15 | 40 informaltable | 1 | 15 | 6.25 | 25 | 25 phrase | 2 | 94 | 2.08 |
20 | 26 indexterm | 5 | 3262 | 0.15 | 17 | 26 variablelist | 1 | 813 |
0.12 | 21 | 21 function | 4 | 4011 | 0.10 | 12 | 28 entry | 11 | 17740 |
0.06 | 21 | 40 para | 3 | 25734 | 0.01 | 21 | 27

Regards,

Brar

Attachments:

add_html_ids.patchtext/plain; charset=UTF-8; name=add_html_ids.patchDownload
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 ff6fcd902a..4549c0a743 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>
@@ -6871,7 +6871,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>
@@ -6902,7 +6902,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>
@@ -7832,7 +7832,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>
@@ -8120,7 +8120,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 38618de01c..0f125d01cf 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>
@@ -1769,7 +1769,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>
@@ -1786,7 +1786,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-insert">
      <term><literal>INSERT</literal></term>
      <listitem>
       <para>
@@ -1799,7 +1799,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-update">
      <term><literal>UPDATE</literal></term>
      <listitem>
       <para>
@@ -1821,7 +1821,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-delete">
      <term><literal>DELETE</literal></term>
      <listitem>
       <para>
@@ -1833,7 +1833,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-truncate">
      <term><literal>TRUNCATE</literal></term>
      <listitem>
       <para>
@@ -1842,7 +1842,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-references">
      <term><literal>REFERENCES</literal></term>
      <listitem>
       <para>
@@ -1852,7 +1852,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-trigger">
      <term><literal>TRIGGER</literal></term>
      <listitem>
       <para>
@@ -1861,7 +1861,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-create">
      <term><literal>CREATE</literal></term>
      <listitem>
       <para>
@@ -1887,7 +1887,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-connect">
      <term><literal>CONNECT</literal></term>
      <listitem>
       <para>
@@ -1898,7 +1898,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-temporary">
      <term><literal>TEMPORARY</literal></term>
      <listitem>
       <para>
@@ -1907,7 +1907,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-execute">
      <term><literal>EXECUTE</literal></term>
      <listitem>
       <para>
@@ -1918,7 +1918,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-usage">
      <term><literal>USAGE</literal></term>
      <listitem>
       <para>
@@ -1962,7 +1962,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-set">
      <term><literal>SET</literal></term>
      <listitem>
       <para>
@@ -1974,7 +1974,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-    <varlistentry>
+    <varlistentry id="ddl-priv-alter_system">
      <term><literal>ALTER SYSTEM</literal></term>
      <listitem>
       <para>
@@ -1984,7 +1984,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
      </listitem>
     </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="ddl-priv-vacuum">
     <term><literal>VACUUM</literal></term>
     <listitem>
      <para>
@@ -1993,7 +1993,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="ddl-priv-analyze">
     <term><literal>ANALYZE</literal></term>
     <listitem>
      <para>
@@ -3760,7 +3760,7 @@ VALUES ('Albany', NULL, NULL, 'NY');
      following forms of partitioning:
 
      <variablelist>
-      <varlistentry>
+      <varlistentry id="ddl-partitioning-overview-range">
        <term>Range Partitioning</term>
 
        <listitem>
@@ -3781,7 +3781,7 @@ VALUES ('Albany', NULL, NULL, 'NY');
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="ddl-partitioning-overview-list">
        <term>List Partitioning</term>
 
        <listitem>
@@ -3792,7 +3792,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 2052d3c844..84eef35ebb 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 9c7f019392..70e9f7b955 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>
@@ -1732,7 +1732,7 @@ build-postgresql:
      this manner:
 
      <variablelist>
-      <varlistentry>
+      <varlistentry id="configure-envvars-bison">
        <term><envar>BISON</envar></term>
        <listitem>
         <para>
@@ -1741,7 +1741,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cc">
        <term><envar>CC</envar></term>
        <listitem>
         <para>
@@ -1750,7 +1750,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cflags">
        <term><envar>CFLAGS</envar></term>
        <listitem>
         <para>
@@ -1759,7 +1759,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-clang">
        <term><envar>CLANG</envar></term>
        <listitem>
         <para>
@@ -1769,7 +1769,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cpp">
        <term><envar>CPP</envar></term>
        <listitem>
         <para>
@@ -1778,7 +1778,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cppflags">
        <term><envar>CPPFLAGS</envar></term>
        <listitem>
         <para>
@@ -1787,7 +1787,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cxx">
        <term><envar>CXX</envar></term>
        <listitem>
         <para>
@@ -1796,7 +1796,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-cxxflags">
        <term><envar>CXXFLAGS</envar></term>
        <listitem>
         <para>
@@ -1805,7 +1805,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-dtrace">
        <term><envar>DTRACE</envar></term>
        <listitem>
         <para>
@@ -1814,7 +1814,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-dtraceflags">
        <term><envar>DTRACEFLAGS</envar></term>
        <listitem>
         <para>
@@ -1823,7 +1823,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-flex">
        <term><envar>FLEX</envar></term>
        <listitem>
         <para>
@@ -1832,7 +1832,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-ldflags">
        <term><envar>LDFLAGS</envar></term>
        <listitem>
         <para>
@@ -1841,7 +1841,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-ldflags_ex">
        <term><envar>LDFLAGS_EX</envar></term>
        <listitem>
         <para>
@@ -1850,7 +1850,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-ldflags_sl">
        <term><envar>LDFLAGS_SL</envar></term>
        <listitem>
         <para>
@@ -1859,7 +1859,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-llvm_config">
        <term><envar>LLVM_CONFIG</envar></term>
        <listitem>
         <para>
@@ -1869,7 +1869,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-msgfmt">
        <term><envar>MSGFMT</envar></term>
        <listitem>
         <para>
@@ -1878,7 +1878,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-perl">
        <term><envar>PERL</envar></term>
        <listitem>
         <para>
@@ -1889,7 +1889,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-python">
        <term><envar>PYTHON</envar></term>
        <listitem>
         <para>
@@ -1901,7 +1901,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-tclsh">
        <term><envar>TCLSH</envar></term>
        <listitem>
         <para>
@@ -1914,7 +1914,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-envvars-xml2_config">
        <term><envar>XML2_CONFIG</envar></term>
        <listitem>
         <para>
@@ -2200,7 +2200,7 @@ ninja install
      </para>
 
      <variablelist>
-      <varlistentry>
+      <varlistentry id="configure-prefix-meson">
        <term><option>--prefix=<replaceable>PREFIX</replaceable></option></term>
        <listitem>
         <para>
@@ -2214,7 +2214,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-bindir-meson">
        <term><option>--bindir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2224,7 +2224,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-sysconfdir-meson">
        <term><option>--sysconfdir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2234,7 +2234,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-libdir-meson">
        <term><option>--libdir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2245,7 +2245,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-includedir-meson">
        <term><option>--includedir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2255,7 +2255,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-datadir-meson">
        <term><option>--datadir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2267,7 +2267,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-localedir-meson">
        <term><option>--localedir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2278,7 +2278,7 @@ ninja install
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-mandir-meson">
        <term><option>--mandir=<replaceable>DIRECTORY</replaceable></option></term>
        <listitem>
         <para>
@@ -2339,7 +2339,7 @@ ninja install
     </para>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="configure-with-nls-meson">
       <term><option>-Dnls={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2352,7 +2352,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-plperl-meson">
       <term><option>-Dplperl={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2362,7 +2362,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-plpython-meson">
       <term><option>-Dplpython={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2372,7 +2372,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-pltcl-meson">
       <term><option>-Dpltcl={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2382,7 +2382,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>
@@ -2391,7 +2391,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-icu-meson">
       <term><option>-Dicu={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2431,7 +2431,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-lz4-meson">
       <term><option>-Dlz4={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2441,7 +2441,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-zstd-meson">
       <term><option>-Dzstd={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2451,7 +2451,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-ssl-meson">
       <term><option>-Dssl=<replaceable>LIBRARY</replaceable></option>
       <indexterm>
        <primary>OpenSSL</primary>
@@ -2471,7 +2471,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-gssapi-meson">
       <term><option>-Dgssapi={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2488,7 +2488,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-ldap-meson">
       <term><option>-Dldap={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2507,7 +2507,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-pam-meson">
       <term><option>-Dpam={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2518,7 +2518,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-bsd_auth-meson">
       <term><option>-Dbsd_auth={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2528,7 +2528,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-systemd-meson">
       <term><option>-Dsystemd={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2544,7 +2544,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-bonjour-meson">
       <term><option>-Dbonjour={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2555,7 +2555,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-uuid-meson">
       <term><option>-Duuid=<replaceable>LIBRARY</replaceable></option></term>
       <listitem>
        <para>
@@ -2594,7 +2594,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-libxml-meson">
       <term><option>-Dlibxml={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2610,7 +2610,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-with-libxslt-meson">
       <term><option>-Dlibxslt={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2629,7 +2629,7 @@ ninja install
     <title>Anti-Features</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="configure-readline-meson">
       <term><option>-Dreadline={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2641,7 +2641,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-libedit_preferred-meson">
       <term><option>-Dlibedit_preferred={ true | false }</option></term>
       <listitem>
        <para>
@@ -2654,7 +2654,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-zlib-meson">
       <term><option>-Dzlib={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -2669,7 +2669,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-spinlocks-meson">
       <term><option>-Dspinlocks={ true | false }</option></term>
       <listitem>
        <para>
@@ -2686,7 +2686,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-atomics-meson">
       <term><option>-Datomics={ true | false }</option></term>
       <listitem>
        <para>
@@ -2705,7 +2705,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>
@@ -2719,7 +2719,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-backend-meson">
       <term><option>--backend=<replaceable>BACKEND</replaceable></option></term>
       <listitem>
        <para>
@@ -2731,7 +2731,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-c_args-meson">
       <term><option>-Dc_args=<replaceable>OPTIONS</replaceable></option></term>
       <listitem>
        <para>
@@ -2740,7 +2740,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>
@@ -2749,7 +2749,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>
@@ -2767,7 +2767,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>
@@ -2783,7 +2783,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>
@@ -2822,7 +2822,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-extra_version-meson">
       <term><option>-Dextra_version=<replaceable>STRING</replaceable></option></term>
       <listitem>
        <para>
@@ -2836,7 +2836,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>
@@ -2856,7 +2856,7 @@ ninja install
     <title>Miscellaneous</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="configure-pgport-meson">
       <term><option>-Dpgport=<replaceable>NUMBER</replaceable></option></term>
       <listitem>
        <para>
@@ -2871,7 +2871,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-krb_srvnam-meson">
       <term><option>-Dkrb_srvnam=<replaceable>NAME</replaceable></option></term>
       <listitem>
        <para>
@@ -2885,7 +2885,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-segsize-meson">
       <term><option>-Dsegsize=<replaceable>SEGSIZE</replaceable></option></term>
       <listitem>
        <para>
@@ -2907,7 +2907,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-blocksize-meson">
       <term><option>-Dblocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
       <listitem>
        <para>
@@ -2920,7 +2920,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-wal_blocksize-meson">
       <term><option>-Dwal_blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
       <listitem>
        <para>
@@ -2955,7 +2955,7 @@ ninja install
     </para>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="configure-buildtype-meson">
       <term><option>--buildtype=<replaceable>BUILDTYPE</replaceable></option></term>
       <listitem>
        <para>
@@ -2977,7 +2977,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-debug-meson">
       <term><option>--debug</option></term>
       <listitem>
        <para>
@@ -2994,7 +2994,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-optimization-meson">
       <term><option>--optimization</option>=<replaceable>LEVEL</replaceable></term>
       <listitem>
        <para>
@@ -3003,7 +3003,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-werror-meson">
       <term><option>--werror</option></term>
       <listitem>
        <para>
@@ -3013,7 +3013,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-cassert-meson">
       <term><option>-Dcassert</option></term>
       <listitem>
        <para>
@@ -3031,7 +3031,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-tap-tests-meson">
       <term><option>-Dtap-tests={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -3043,7 +3043,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>
@@ -3054,7 +3054,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-b_coverage-meson">
       <term><option>-Db_coverage</option></term>
       <listitem>
        <para>
@@ -3069,7 +3069,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="configure-dtrace-meson">
       <term><option>-Ddtrace={ auto | enabled | disabled }</option></term>
       <listitem>
        <para>
@@ -3187,7 +3187,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>
@@ -3338,7 +3338,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 -->
 
@@ -3686,7 +3686,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>
@@ -3711,7 +3711,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>
@@ -3730,7 +3730,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>
@@ -3751,7 +3751,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 f9558dec3b..3c8fadb63c 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 d4ee34ee0f..585cafdb2a 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>
@@ -473,7 +473,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>
@@ -583,7 +583,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>
@@ -673,7 +673,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>
@@ -764,7 +764,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 2b2a1a8215..73c3f7ee59 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>
@@ -3190,7 +3190,7 @@ DECLARE
      </para>
     </note>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-opening-open-for-query">
      <title><command>OPEN FOR</command> <replaceable>query</replaceable></title>
 
 <synopsis>
@@ -3224,7 +3224,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>
@@ -3349,7 +3349,7 @@ BEGIN
      only until the end of the transaction.
     </para>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-using-fetch">
      <title><literal>FETCH</literal></title>
 
 <synopsis>
@@ -3406,7 +3406,7 @@ FETCH RELATIVE -2 FROM curs4 INTO x;
        </para>
      </sect3>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-using-move">
      <title><literal>MOVE</literal></title>
 
 <synopsis>
@@ -3433,7 +3433,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>
@@ -3459,7 +3459,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>
@@ -3480,7 +3480,7 @@ CLOSE curs1;
        </para>
      </sect3>
 
-    <sect3>
+    <sect3 id="plpgsql-cursor-using-returning">
      <title>Returning Cursors</title>
 
        <para>
@@ -3809,7 +3809,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
@@ -3818,21 +3818,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
@@ -3841,7 +3841,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>
@@ -4031,7 +4031,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>
@@ -4042,7 +4042,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>
@@ -4053,7 +4053,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>
@@ -4062,7 +4062,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>
@@ -4072,7 +4072,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>
@@ -4082,7 +4082,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>
@@ -4093,7 +4093,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>
@@ -4102,7 +4102,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>
@@ -4113,7 +4113,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>
@@ -4122,7 +4122,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>
@@ -4131,7 +4131,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>
@@ -4141,7 +4141,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>
@@ -4646,7 +4646,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>
@@ -4655,7 +4655,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>
@@ -5109,7 +5109,7 @@ $PROC$ LANGUAGE plpgsql;
   </para>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="plpgsql-quote-tips-1-quot">
     <term>1 quotation mark</term>
     <listitem>
      <para>
@@ -5125,7 +5125,7 @@ CREATE FUNCTION foo() RETURNS integer AS '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="plpgsql-quote-tips-2-quot">
     <term>2 quotation marks</term>
     <listitem>
      <para>
@@ -5145,7 +5145,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>
@@ -5168,7 +5168,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>
@@ -5189,7 +5189,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>
@@ -5254,7 +5254,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>
@@ -5263,7 +5263,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>
@@ -5281,7 +5281,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>
@@ -5466,7 +5466,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>
@@ -5902,7 +5902,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 527f4deaaa..f688e1b42d 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>
@@ -328,7 +328,7 @@ OPTIONS (ADD password_required 'false');
 
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-remote-execution">
    <title>Remote Execution Options</title>
 
    <para>
@@ -409,7 +409,7 @@ OPTIONS (ADD password_required 'false');
 
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-asynchronous-execution">
    <title>Asynchronous Execution Options</title>
 
    <para>
@@ -460,7 +460,7 @@ OPTIONS (ADD password_required 'false');
    </variablelist>
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-transaction-management">
    <title>Transaction Management Options</title>
 
    <para>
@@ -510,7 +510,7 @@ OPTIONS (ADD password_required 'false');
 
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-updatability">
    <title>Updatability Options</title>
 
    <para>
@@ -547,7 +547,7 @@ OPTIONS (ADD password_required 'false');
    </variablelist>
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-truncatability">
    <title>Truncatability Options</title>
 
    <para>
@@ -578,7 +578,7 @@ OPTIONS (ADD password_required 'false');
    </variablelist>
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-importing">
    <title>Importing Options</title>
 
    <para>
@@ -686,7 +686,7 @@ OPTIONS (ADD password_required 'false');
 
   </sect3>
 
-  <sect3>
+  <sect3 id="postgres-fdw-options-connection-management">
     <title>Connection Management Options</title>
 
     <para>
@@ -715,7 +715,7 @@ OPTIONS (ADD password_required 'false');
    </sect3>
  </sect2>
 
-<sect2>
+<sect2 id="postgres-fdw-functions">
   <title>Functions</title>
 
   <variablelist>
@@ -794,7 +794,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
 
 </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-connection-management">
   <title>Connection Management</title>
 
   <para>
@@ -831,7 +831,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-transaction-management">
   <title>Transaction Management</title>
 
   <para>
@@ -866,7 +866,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-remote-query-optimization">
   <title>Remote Query Optimization</title>
 
   <para>
@@ -909,7 +909,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>
@@ -965,7 +965,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-cross-version-compatibility">
   <title>Cross-Version Compatibility</title>
 
   <para>
@@ -985,7 +985,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-configuration-parameters">
   <title>Configuration Parameters</title>
 
   <variablelist>
@@ -1085,7 +1085,7 @@ postgres=# SELECT postgres_fdw_disconnect_all();
   </variablelist>
  </sect2>
 
- <sect2>
+ <sect2 id="postgres-fdw-examples">
   <title>Examples</title>
 
   <para>
@@ -1149,7 +1149,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 5fdd429e05..e252e96791 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>
@@ -1108,7 +1108,7 @@ SELCT 1/0;<!-- this typo is intentional -->
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-function-call">
    <title>Function Call</title>
 
    <para>
@@ -1385,7 +1385,7 @@ SELCT 1/0;<!-- this typo is intentional -->
    </note>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-canceling-requests">
    <title>Canceling Requests in Progress</title>
 
    <para>
@@ -1449,7 +1449,7 @@ SELCT 1/0;<!-- this typo is intentional -->
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-termination">
    <title>Termination</title>
 
    <para>
@@ -1489,7 +1489,7 @@ SELCT 1/0;<!-- this typo is intentional -->
    </para>
   </sect2>
 
-  <sect2>
+  <sect2 id="protocol-flow-ssl">
    <title><acronym>SSL</acronym> Session Encryption</title>
 
    <para>
@@ -1562,7 +1562,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 d3dd638b14..a0672d20fd 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>
@@ -1900,7 +1900,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>
@@ -1914,7 +1914,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>
@@ -1928,7 +1928,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>
@@ -1945,7 +1945,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>
@@ -1964,7 +1964,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>
@@ -1978,7 +1978,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>
@@ -2000,7 +2000,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>
@@ -2014,7 +2014,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>
@@ -2067,7 +2067,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>
@@ -2092,7 +2092,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>
@@ -2144,7 +2144,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>
@@ -2156,7 +2156,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-errverbose">
         <term><literal>\errverbose</literal></term>
 
         <listitem>
@@ -2170,7 +2170,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>
@@ -2205,7 +2205,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>
@@ -2218,7 +2218,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>
@@ -2273,7 +2273,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gdesc">
         <term><literal>\gdesc</literal></term>
 
         <listitem>
@@ -2292,7 +2292,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>
@@ -2314,7 +2314,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gexec">
         <term><literal>\gexec</literal></term>
 
         <listitem>
@@ -2360,7 +2360,7 @@ CREATE INDEX
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gset">
         <term><literal>\gset [ <replaceable class="parameter">prefix</replaceable> ]</literal></term>
 
         <listitem>
@@ -2405,7 +2405,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>
@@ -2419,7 +2419,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>
@@ -2450,7 +2450,7 @@ hello 10
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-html">
         <term><literal>\H</literal> or <literal>\html</literal></term>
         <listitem>
         <para>
@@ -2464,7 +2464,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>
@@ -2579,7 +2579,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>
@@ -2594,7 +2594,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>
@@ -2611,7 +2611,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>
@@ -2635,7 +2635,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>
@@ -2664,7 +2664,7 @@ lo_import 152801
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-lo_list">
         <term><literal>\lo_list[+]</literal></term>
         <listitem>
         <para>
@@ -2678,7 +2678,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>
@@ -2698,7 +2698,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>
@@ -2737,7 +2737,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-print">
         <term><literal>\p</literal> or <literal>\print</literal></term>
         <listitem>
         <para>
@@ -2748,7 +2748,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>
@@ -2761,7 +2761,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>
@@ -2780,7 +2780,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>
@@ -2805,7 +2805,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>
@@ -2825,7 +2825,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-columns">
           <term><literal>columns</literal></term>
           <listitem>
           <para>
@@ -2844,7 +2844,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-csv_fieldsep">
           <term><literal>csv_fieldsep</literal></term>
           <listitem>
           <para>
@@ -2857,7 +2857,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>
@@ -2879,7 +2879,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-xheader_width">
           <term><literal>xheader_width</literal></term>
           <listitem>
           <para>
@@ -2912,7 +2912,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-fieldsep">
           <term><literal>fieldsep</literal></term>
           <listitem>
           <para>
@@ -2926,7 +2926,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-fieldsep_zero">
           <term><literal>fieldsep_zero</literal></term>
           <listitem>
           <para>
@@ -2936,7 +2936,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-footer">
           <term><literal>footer</literal></term>
           <listitem>
           <para>
@@ -2950,7 +2950,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-format">
           <term><literal>format</literal></term>
           <listitem>
           <para>
@@ -3027,7 +3027,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-linestyle">
           <term><literal>linestyle</literal></term>
           <listitem>
           <para>
@@ -3078,7 +3078,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-null">
           <term><literal>null</literal></term>
           <listitem>
           <para>
@@ -3090,7 +3090,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-numericlocale">
           <term><literal>numericlocale</literal></term>
           <listitem>
           <para>
@@ -3104,7 +3104,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-pager">
           <term><literal>pager</literal></term>
           <listitem>
           <para>
@@ -3139,7 +3139,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>
@@ -3151,7 +3151,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-recordsep">
           <term><literal>recordsep</literal></term>
           <listitem>
           <para>
@@ -3161,7 +3161,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-recordsep_zero">
           <term><literal>recordsep_zero</literal></term>
           <listitem>
           <para>
@@ -3171,7 +3171,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>
@@ -3195,7 +3195,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>
@@ -3207,7 +3207,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>
@@ -3223,7 +3223,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>
@@ -3234,7 +3234,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>
@@ -3245,7 +3245,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>
@@ -3276,7 +3276,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-quit">
         <term><literal>\q</literal> or <literal>\quit</literal></term>
         <listitem>
         <para>
@@ -3287,7 +3287,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>
@@ -3299,7 +3299,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-reset">
         <term><literal>\r</literal> or <literal>\reset</literal></term>
         <listitem>
         <para>
@@ -3309,7 +3309,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>
@@ -3325,7 +3325,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>
@@ -3365,7 +3365,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>
@@ -3382,7 +3382,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>
@@ -3417,7 +3417,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>
@@ -3443,7 +3443,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>
@@ -3455,7 +3455,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>
@@ -3469,7 +3469,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>
@@ -3483,7 +3483,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>
@@ -3502,7 +3502,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>
@@ -3526,7 +3526,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>
@@ -3538,7 +3538,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>
@@ -3556,7 +3556,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>
@@ -3567,7 +3567,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>
@@ -3586,7 +3586,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>
@@ -3606,7 +3606,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>
@@ -3623,7 +3623,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-semicolon">
         <term><literal>\;</literal></term>
         <listitem>
         <para>
@@ -3847,7 +3847,7 @@ bar
    </para>
 
     <variablelist>
-      <varlistentry>
+      <varlistentry id="app-psql-variables-autocommit">
       <term>
        <varname>AUTOCOMMIT</varname>
        <indexterm>
@@ -3891,7 +3891,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-comp_keyword_case">
         <term><varname>COMP_KEYWORD_CASE</varname></term>
         <listitem>
         <para>
@@ -3907,7 +3907,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-dbname">
         <term><varname>DBNAME</varname></term>
         <listitem>
         <para>
@@ -3918,7 +3918,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-echo">
         <term><varname>ECHO</varname></term>
         <listitem>
         <para>
@@ -3937,7 +3937,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-echo_hidden">
         <term><varname>ECHO_HIDDEN</varname></term>
         <listitem>
         <para>
@@ -3954,7 +3954,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-encoding">
         <term><varname>ENCODING</varname></term>
         <listitem>
         <para>
@@ -3966,7 +3966,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-error">
        <term><varname>ERROR</varname></term>
        <listitem>
         <para>
@@ -3976,7 +3976,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-fetch_count">
         <term><varname>FETCH_COUNT</varname></term>
         <listitem>
         <para>
@@ -4004,7 +4004,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-hide_tableam">
         <term><varname>HIDE_TABLEAM</varname></term>
         <listitem>
         <para>
@@ -4015,7 +4015,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-hide_toast_compression">
         <term><varname>HIDE_TOAST_COMPRESSION</varname></term>
         <listitem>
         <para>
@@ -4026,7 +4026,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-histcontrol">
         <term><varname>HISTCONTROL</varname></term>
         <listitem>
         <para>
@@ -4047,7 +4047,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-histfile">
         <term><varname>HISTFILE</varname></term>
         <listitem>
         <para>
@@ -4073,7 +4073,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-histsize">
         <term><varname>HISTSIZE</varname></term>
         <listitem>
         <para>
@@ -4089,7 +4089,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-host">
         <term><varname>HOST</varname></term>
         <listitem>
         <para>
@@ -4100,7 +4100,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-ignoreeof">
         <term><varname>IGNOREEOF</varname></term>
         <listitem>
         <para>
@@ -4121,7 +4121,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-lastoid">
         <term><varname>LASTOID</varname></term>
         <listitem>
         <para>
@@ -4137,7 +4137,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>
@@ -4150,7 +4150,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-on_error_rollback">
       <term>
        <varname>ON_ERROR_ROLLBACK</varname>
        <indexterm>
@@ -4174,7 +4174,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-on_error_stop">
         <term><varname>ON_ERROR_STOP</varname></term>
         <listitem>
         <para>
@@ -4193,7 +4193,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-port">
         <term><varname>PORT</varname></term>
         <listitem>
         <para>
@@ -4204,7 +4204,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>
@@ -4217,7 +4217,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-quiet">
         <term><varname>QUIET</varname></term>
         <listitem>
         <para>
@@ -4228,7 +4228,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-row_count">
        <term><varname>ROW_COUNT</varname></term>
        <listitem>
         <para>
@@ -4238,7 +4238,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>
@@ -4253,7 +4253,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-show_all_results">
         <term><varname>SHOW_ALL_RESULTS</varname></term>
         <listitem>
         <para>
@@ -4265,7 +4265,7 @@ bar
         </listitem>
       </varlistentry>
 
-       <varlistentry>
+      <varlistentry id="app-psql-variables-show_context">
         <term><varname>SHOW_CONTEXT</varname></term>
         <listitem>
         <para>
@@ -4283,7 +4283,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-singleline">
         <term><varname>SINGLELINE</varname></term>
         <listitem>
         <para>
@@ -4293,7 +4293,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-singlestep">
         <term><varname>SINGLESTEP</varname></term>
         <listitem>
         <para>
@@ -4303,7 +4303,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-sqlstate">
        <term><varname>SQLSTATE</varname></term>
        <listitem>
         <para>
@@ -4314,7 +4314,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-user">
         <term><varname>USER</varname></term>
         <listitem>
         <para>
@@ -4325,7 +4325,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-verbosity">
         <term><varname>VERBOSITY</varname></term>
         <listitem>
         <para>
@@ -4339,7 +4339,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>
@@ -4468,7 +4468,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>
@@ -4482,7 +4482,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>
@@ -4493,12 +4493,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>
@@ -4510,18 +4510,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>
@@ -4534,14 +4534,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>
@@ -4564,7 +4564,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>
@@ -4577,7 +4577,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>
@@ -4586,7 +4586,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>
@@ -4595,7 +4595,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>
@@ -4606,7 +4606,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>
@@ -4617,7 +4617,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>
@@ -4639,7 +4639,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>
@@ -4739,7 +4739,7 @@ $endif
 
   <variablelist>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-columns">
     <term><envar>COLUMNS</envar></term>
 
     <listitem>
@@ -4752,7 +4752,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>
@@ -4765,7 +4765,7 @@ $endif
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-pg_color">
     <term><envar>PG_COLOR</envar></term>
     <listitem>
      <para>
@@ -4776,7 +4776,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>
@@ -4793,7 +4793,7 @@ $endif
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psql_editor_linenumber_arg">
     <term><envar>PSQL_EDITOR_LINENUMBER_ARG</envar></term>
 
     <listitem>
@@ -4821,7 +4821,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psql_history">
     <term><envar>PSQL_HISTORY</envar></term>
 
     <listitem>
@@ -4831,7 +4831,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>
 
@@ -4852,7 +4852,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>
@@ -4870,7 +4870,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psqlrc">
     <term><envar>PSQLRC</envar></term>
 
     <listitem>
@@ -4880,7 +4880,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-shell">
     <term><envar>SHELL</envar></term>
 
     <listitem>
@@ -4890,7 +4890,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-tmpdir">
     <term><envar>TMPDIR</envar></term>
 
     <listitem>
@@ -4915,7 +4915,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>
@@ -4963,7 +4963,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>
#8Brar Piening
brar@gmx.de
In reply to: Brar Piening (#6)
1 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On 06.12.2022 at 18:59, Brar Piening wrote:

On 06.12.2022 at 09:38, Alvaro Herrera wrote:

I would welcome separate patches: one to add the IDs, another for the
XSL/CSS stuff.  That allows us to discuss them separately.

I'll send two patches in two separate e-mails in a moment.

This is patch no 2 that adds links to html elements with ids to make
them visible on the HTML surface when hovering the element.

Regards,

Brar

Attachments:

make_html_ids_discoverable.patchtext/plain; charset=UTF-8; name=make_html_ids_discoverable.patchDownload
diff --git a/doc/src/sgml/stylesheet-html-common.xsl b/doc/src/sgml/stylesheet-html-common.xsl
index 9df2782ce4..111b03d6fc 100644
--- a/doc/src/sgml/stylesheet-html-common.xsl
+++ b/doc/src/sgml/stylesheet-html-common.xsl
@@ -301,4 +301,115 @@ set       toc,title
   </xsl:choose>
 </xsl:template>
 
+
+<!-- Overridden template to add links to ids in varlists -->
+<xsl:template match="varlistentry">
+  <dt>
+    <xsl:call-template name="id.attribute"/>
+    <xsl:call-template name="anchor"/>
+    <xsl:apply-templates select="term"/>
+    <xsl:call-template name="pg.id.link"/>
+  </dt>
+  <dd>
+    <xsl:apply-templates select="listitem"/>
+  </dd>
+</xsl:template>
+
+<!-- Overridden template to add links to ids in sections -->
+<xsl:template name="section.heading">
+  <xsl:param name="section" select="."/>
+  <xsl:param name="level" select="1"/>
+  <xsl:param name="allow-anchors" select="1"/>
+  <xsl:param name="title"/>
+  <xsl:param name="class" select="'title'"/>
+
+  <xsl:variable name="id">
+    <xsl:choose>
+      <!-- Make sure the subtitle doesn't get the same id as the title -->
+      <xsl:when test="self::subtitle">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="."/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- if title is in an *info wrapper, get the grandparent -->
+      <xsl:when test="contains(local-name(..), 'info')">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="../.."/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select=".."/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- HTML H level is one higher than section level -->
+  <xsl:variable name="hlevel">
+    <xsl:choose>
+      <!-- highest valid HTML H level is H6; so anything nested deeper
+           than 5 levels down just becomes H6 -->
+      <xsl:when test="$level &gt; 5">6</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$level + 1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
+    <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
+    <xsl:if test="$css.decoration != '0'">
+      <xsl:if test="$hlevel&lt;3">
+        <xsl:attribute name="style">clear: both</xsl:attribute>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="$allow-anchors != 0">
+      <xsl:call-template name="anchor">
+        <xsl:with-param name="node" select="$section"/>
+        <xsl:with-param name="conditional" select="0"/>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:copy-of select="$title"/>
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="$section"/>
+    </xsl:call-template>
+  </xsl:element>
+</xsl:template>
+
+<!-- Creates a link pointing to an id within the document -->
+<xsl:template name="pg.id.link">
+  <xsl:param name="object" select="."/>
+  <xsl:choose>
+    <xsl:when test="$object/@id or $object/@xml:id">
+      <a>
+        <xsl:attribute name="href">
+          <xsl:text>#</xsl:text>
+          <xsl:call-template name="object.id">
+            <xsl:with-param name="object" select="$object"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="class">
+          <xsl:text>id_link</xsl:text>
+        </xsl:attribute>
+        <xsl:text> #</xsl:text>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- Only complain about varlistentries if at least one entry in the list has an id -->
+      <xsl:if test="name($object) != 'varlistentry' or $object/parent::variablelist/varlistentry[@id]">
+        <xsl:message terminate="no">
+          <xsl:value-of select ="name($object)"/>
+          <xsl:text> element without id. Please add an id to make it usable</xsl:text>
+          <xsl:text> as stable anchor in the public HTML documentation.</xsl:text>
+        </xsl:message>
+        <xsl:comment>
+          <xsl:text>Please add an id to the </xsl:text>
+          <xsl:value-of select ="name($object)"/>
+          <xsl:text> element in the sgml source code.</xsl:text>
+        </xsl:comment>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index 6410a47958..e4174e0613 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -163,3 +163,13 @@ acronym		{ font-style: inherit; }
     width: 75%;
   }
 }
+
+/* Links to ids of headers and definition terms */
+a.id_link {
+        color: inherit;
+        visibility: hidden;
+}
+
+*:hover > a.id_link {
+        visibility: visible;
+}
#9Brar Piening
brar@gmx.de
In reply to: Brar Piening (#7)
Re: doc: add missing "id" attributes to extension packaging page

On 06.12.2022 at 19:11, Brar Piening wrote:

The current statistics for docbook elements with/without ids after
applying the patch are the following:

Somehow my e-mail client destroyed the table. That's how it was supposed
to look like:

     name      | with_id | without_id | id_coverage | min_id_len |
max_id_len
---------------+---------+------------+-------------+------------+------------
 sect2         |     870 |          0 |      100.00 |          7
|         57
 sect1         |     739 |          0 |      100.00 |          4
|         46
 refentry      |     307 |          0 |      100.00 |          8
|         37
 sect3         |     206 |          0 |      100.00 |         11
|         57
 chapter       |      77 |          0 |      100.00 |          5
|         24
 sect4         |      28 |          0 |      100.00 |         16
|         47
 biblioentry   |      23 |          0 |      100.00 |          6
|         15
 simplesect    |      20 |          0 |      100.00 |         24
|         39
 appendix      |      15 |          0 |      100.00 |          7
|         23
 part          |       8 |          0 |      100.00 |          5
|         20
 co            |       4 |          0 |      100.00 |         18
|         30
 figure        |       3 |          0 |      100.00 |         13
|         28
 reference     |       3 |          0 |      100.00 |         14
|         18
 anchor        |       1 |          0 |      100.00 |         21
|         21
 bibliography  |       1 |          0 |      100.00 |          8
|          8
 book          |       1 |          0 |      100.00 |         10
|         10
 index         |       1 |          0 |      100.00 |         11
|         11
 legalnotice   |       1 |          0 |      100.00 |         13
|         13
 preface       |       1 |          0 |      100.00 |          9
|          9
 glossentry    |     119 |         14 |       89.47 |         13
|         32
 table         |     285 |        162 |       63.76 |         12
|         56
 example       |      27 |         16 |       62.79 |         12
|         42
 refsect3      |       5 |          3 |       62.50 |         19
|         24
 refsect2      |      41 |         56 |       42.27 |         10
|         36
 varlistentry  |    1701 |       3172 |       34.91 |          9
|         64
 footnote      |       5 |         18 |       21.74 |         17
|         32
 step          |      28 |        130 |       17.72 |          7
|         28
 refsect1      |     151 |       1333 |       10.18 |         15
|         40
 informaltable |       1 |         15 |        6.25 |         25
|         25
 phrase        |       2 |         94 |        2.08 |         20
|         26
 indexterm     |       5 |       3262 |        0.15 |         17
|         26
 variablelist  |       1 |        813 |        0.12 |         21
|         21
 function      |       4 |       4011 |        0.10 |         12
|         28
 entry         |      11 |      17740 |        0.06 |         21
|         40
 para          |       3 |      25734 |        0.01 |         21
|         27

#10Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#9)
1 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

Hello,

Attached is a new patch (add_html_ids_v2.patch), almost identical to
the old but modified so that it applies. There were 2 changes (made
to sgml/plpgsql.stml and sgml/ddl.sgml) that prevented the patch from
applying. (In ddl.sgml the VACUUM and ANALYZE privileges were
combined into MAINTAIN. In plpgsql.sgml an id attribute was added.)

If the author will look over my version of the patch I believe it can
be approved and sent on to the committers.

What follows is my notes for the committers:

The ids look reasonably consistent, with "nesting" so that ids of
sub-sections mostly have (at least some of) the id of the parent
section as a prefix. There are a few inconsistencies. A sect3 has
id="collation-managing-standard" and sect4 has
id="collation-managing-predefined". There is a slight possibility of
conflict, as in this case sect4 ids omit the last word of the section
3 ids it is possible to have conflicts with the ids of the sect4s in
other sect3s of the same file. I don't have a problem with this.

(I see establishing strict standards for id values as excessive.)

The above was the only case I noticed. I also tried counting words,
"-" delimited, in ids and found no cases with fewer words than the
number of section levels. Here's the hack:

egrep '^\+ *<sect' /tmp/add_html_ids.patch \
| gawk '{if (int(substr($2, length($2), 1)) < split($2, dummy, "-"))
print $0;}'

As far as I know the ids are consistent with the rest of the
documentation. They are not entirely consistent in construction.
Mostly they copy the section title, but sometimes words are omitted.
E.g in sgml/charset.sgml where sect2 is "Managing Collations" with
id="collation-managing" and sect3 is "Standard Collations" with
id="collation-managing-standard". Also there is at least one
abbreviation in the id of a word in the title.
(id="installation-notes-aix-mem-management" v.s a title of "Memory
Management") All this seems fine to me.

The ids are sometimes very long. This also seems ok.

I did not do a particularly close look at the id values for
varlistentrys. Scanning the patch they seem fine.

I can confirm that all the patch does is add ids.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

add_html_ids_v2.patchtext/x-patchDownload
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>
#11Brar Piening
brar@gmx.de
In reply to: Karl O. Pinc (#10)
Re: doc: add missing "id" attributes to extension packaging page

On 02.01.2023 at 21:53, Karl O. Pinc wrote:

If the author will look over my version of the patch I believe it can
be approved and sent on to the committers.

LGTM.

Thanks!

Brar

#12Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#11)
Re: doc: add missing "id" attributes to extension packaging page

On Tue, 3 Jan 2023 21:35:09 +0100
Brar Piening <brar@gmx.de> wrote:

On 02.01.2023 at 21:53, Karl O. Pinc wrote:

If the author will look over my version of the patch I believe it
can be approved and sent on to the committers.

LGTM.

Approved for committer!

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#13vignesh C
vignesh21@gmail.com
In reply to: Karl O. Pinc (#12)
Re: doc: add missing "id" attributes to extension packaging page

On Wed, 4 Jan 2023 at 04:13, Karl O. Pinc <kop@karlpinc.com> wrote:

On Tue, 3 Jan 2023 21:35:09 +0100
Brar Piening <brar@gmx.de> wrote:

On 02.01.2023 at 21:53, Karl O. Pinc wrote:

If the author will look over my version of the patch I believe it
can be approved and sent on to the committers.

LGTM.

Approved for committer!

The patch does not apply on top of HEAD as in [1]http://cfbot.cputube.org/patch_41_4041.log, please post a rebased patch:
=== Applying patches on top of PostgreSQL commit ID
cd9479af2af25d7fa9bfd24dd4dcf976b360f077 ===
=== applying patch ./add_html_ids_v2.patch
....
patching file doc/src/sgml/ref/pgbench.sgml
patching file doc/src/sgml/ref/psql-ref.sgml
Hunk #73 FAILED at 1824.
....
2 out of 208 hunks FAILED -- saving rejects to file
doc/src/sgml/ref/psql-ref.sgml.rej

[1]: http://cfbot.cputube.org/patch_41_4041.log

Regards,
Vignesh

#14vignesh C
vignesh21@gmail.com
In reply to: vignesh C (#13)
Re: doc: add missing "id" attributes to extension packaging page

On Mon, 9 Jan 2023 at 08:01, vignesh C <vignesh21@gmail.com> wrote:

On Wed, 4 Jan 2023 at 04:13, Karl O. Pinc <kop@karlpinc.com> wrote:

On Tue, 3 Jan 2023 21:35:09 +0100
Brar Piening <brar@gmx.de> wrote:

On 02.01.2023 at 21:53, Karl O. Pinc wrote:

If the author will look over my version of the patch I believe it
can be approved and sent on to the committers.

LGTM.

Approved for committer!

The patch does not apply on top of HEAD as in [1], please post a rebased patch:
=== Applying patches on top of PostgreSQL commit ID
cd9479af2af25d7fa9bfd24dd4dcf976b360f077 ===
=== applying patch ./add_html_ids_v2.patch
....
patching file doc/src/sgml/ref/pgbench.sgml
patching file doc/src/sgml/ref/psql-ref.sgml
Hunk #73 FAILED at 1824.
....
2 out of 208 hunks FAILED -- saving rejects to file
doc/src/sgml/ref/psql-ref.sgml.rej

[1] - http://cfbot.cputube.org/patch_41_4041.log

There are couple of commitfest entries for this:
https://commitfest.postgresql.org/41/4041/
https://commitfest.postgresql.org/41/4042/

Can one of them be closed?

Regards,
Vignesh

#15Brar Piening
brar@gmx.de
In reply to: vignesh C (#13)
1 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On 09.01.2023 at 03:31, vignesh C wrote:

The patch does not apply on top of HEAD as in [1], please post a rebased patch:

Voilà

This one applies on top of 3c569049b7b502bb4952483d19ce622ff0af5fd6 and
the documentation build succeeds. Beyond rebasing I've added a few more
ids (to make the other patch (make_html_ids_discoverable.patch) build
without warnings again) but nothing that would justify another review.

We probably have to move quickly with this patch since it touches pretty
much any file in the documentation and will be outdated in a minute.

Regards,

Brar

Attachments:

add_html_ids_v3.patchtext/plain; charset=UTF-8; name=add_html_ids_v3.patchDownload
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 0899e55e4c..88bc767c23 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 a33a93570b..c3af1e4fc6 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>
@@ -6954,7 +6954,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>
@@ -6985,7 +6985,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>
@@ -7915,7 +7915,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>
@@ -8203,7 +8203,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..73d6c8f50d 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>
@@ -1682,7 +1682,7 @@ build-postgresql:
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-option-with-segsize-blocks">
        <term><option>--with-segsize-blocks=SEGSIZE_BLOCKS</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>
@@ -3112,7 +3112,7 @@ ninja install
       </listitem>
      </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="configure-segsize_blocks-meson">
        <term><option>-Dsegsize_blocks=SEGSIZE_BLOCKS</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 edea1eadb8..45a86188cb 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>
@@ -188,7 +188,7 @@ Europe &amp; Russia*@ &amp; !Transportation
   </para>
  </sect2>
 
- <sect2>
+ <sect2 id="ltree-ops-funcs">
   <title>Operators and Functions</title>
 
   <para>
@@ -608,7 +608,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
@@ -686,7 +686,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>
@@ -823,7 +823,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>
@@ -843,7 +843,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 439ef675f3..93fc7167d4 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_role.sgml b/doc/src/sgml/ref/alter_role.sgml
index 8a8f828137..dbf8eef173 100644
--- a/doc/src/sgml/ref/alter_role.sgml
+++ b/doc/src/sgml/ref/alter_role.sgml
@@ -52,7 +52,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
 </synopsis>
  </refsynopsisdiv>
 
- <refsect1>
+ <refsect1 id="sql-alterrole-desc">
   <title>Description</title>
 
   <para>
@@ -123,11 +123,11 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
   </para>
  </refsect1>
 
- <refsect1>
+ <refsect1 id="sql-alterrole-params">
   <title>Parameters</title>
 
     <variablelist>
-     <varlistentry>
+     <varlistentry id="sql-alterrole-params-name">
       <term><replaceable class="parameter">name</replaceable></term>
       <listitem>
        <para>
@@ -136,7 +136,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-alterrole-params-current_role">
       <term><literal>CURRENT_ROLE</literal></term>
       <term><literal>CURRENT_USER</literal></term>
       <listitem>
@@ -146,7 +146,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-alterrole-params-session_user">
       <term><literal>SESSION_USER</literal></term>
       <listitem>
        <para>
@@ -156,7 +156,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-alterrole-params-superuser-et-al">
       <term><literal>SUPERUSER</literal></term>
       <term><literal>NOSUPERUSER</literal></term>
       <term><literal>CREATEDB</literal></term>
@@ -184,7 +184,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-alterrole-params-new_name">
       <term><replaceable>new_name</replaceable></term>
       <listitem>
        <para>
@@ -193,7 +193,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-alterrole-params-database_name">
        <term><replaceable>database_name</replaceable></term>
        <listitem>
          <para>
@@ -202,7 +202,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
        </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="sql-alterrole-params-configuration_parameter">
       <term><replaceable>configuration_parameter</replaceable></term>
       <term><replaceable>value</replaceable></term>
       <listitem>
@@ -250,7 +250,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
     </variablelist>
  </refsect1>
 
- <refsect1>
+ <refsect1 id="sql-alterrole-notes">
   <title>Notes</title>
 
   <para>
@@ -284,7 +284,7 @@ ALTER ROLE { <replaceable class="parameter">role_specification</replaceable> | A
   </para>
  </refsect1>
 
- <refsect1>
+ <refsect1 id="sql-alterrole-examples">
   <title>Examples</title>
 
   <para>
@@ -352,7 +352,7 @@ ALTER ROLE fred SET my.param = 'value' USER SET;
 </programlisting></para>
  </refsect1>
 
- <refsect1>
+ <refsect1 id="sql-alterrole-compat">
   <title>Compatibility</title>
 
   <para>
@@ -361,7 +361,7 @@ ALTER ROLE fred SET my.param = 'value' USER SET;
   </para>
  </refsect1>
 
- <refsect1>
+ <refsect1 id="sql-alterrole-see">
   <title>See Also</title>
 
   <simplelist type="inline">
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 892df57f70..6d5427f70b 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 3f994a3592..08b55cbe24 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[S] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -1848,7 +1848,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>
@@ -1880,7 +1880,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>
@@ -1909,7 +1909,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>
@@ -1923,7 +1923,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>
@@ -1937,7 +1937,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>
@@ -1954,7 +1954,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>
@@ -1973,7 +1973,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>
@@ -1987,7 +1987,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>
@@ -2009,7 +2009,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>
@@ -2023,7 +2023,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>
@@ -2076,7 +2076,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>
@@ -2101,7 +2101,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>
@@ -2153,7 +2153,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>
@@ -2165,7 +2165,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-errverbose">
         <term><literal>\errverbose</literal></term>
 
         <listitem>
@@ -2179,7 +2179,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>
@@ -2214,7 +2214,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>
@@ -2227,7 +2227,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>
@@ -2282,7 +2282,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gdesc">
         <term><literal>\gdesc</literal></term>
 
         <listitem>
@@ -2301,7 +2301,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>
@@ -2323,7 +2323,7 @@ Tue Oct 26 21:40:57 CEST 1999
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gexec">
         <term><literal>\gexec</literal></term>
 
         <listitem>
@@ -2369,7 +2369,7 @@ CREATE INDEX
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-gset">
         <term><literal>\gset [ <replaceable class="parameter">prefix</replaceable> ]</literal></term>
 
         <listitem>
@@ -2414,7 +2414,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>
@@ -2428,7 +2428,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>
@@ -2459,7 +2459,7 @@ hello 10
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-html">
         <term><literal>\H</literal> or <literal>\html</literal></term>
         <listitem>
         <para>
@@ -2473,7 +2473,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>
@@ -2588,7 +2588,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>
@@ -2603,7 +2603,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>
@@ -2620,7 +2620,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>
@@ -2644,7 +2644,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>
@@ -2673,7 +2673,7 @@ lo_import 152801
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-lo_list">
         <term><literal>\lo_list[+]</literal></term>
         <listitem>
         <para>
@@ -2687,7 +2687,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>
@@ -2707,7 +2707,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>
@@ -2746,7 +2746,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-print">
         <term><literal>\p</literal> or <literal>\print</literal></term>
         <listitem>
         <para>
@@ -2757,7 +2757,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>
@@ -2770,7 +2770,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>
@@ -2789,7 +2789,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>
@@ -2814,7 +2814,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>
@@ -2834,7 +2834,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-columns">
           <term><literal>columns</literal></term>
           <listitem>
           <para>
@@ -2853,7 +2853,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-csv_fieldsep">
           <term><literal>csv_fieldsep</literal></term>
           <listitem>
           <para>
@@ -2866,7 +2866,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>
@@ -2888,7 +2888,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-xheader_width">
           <term><literal>xheader_width</literal></term>
           <listitem>
           <para>
@@ -2921,7 +2921,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-fieldsep">
           <term><literal>fieldsep</literal></term>
           <listitem>
           <para>
@@ -2935,7 +2935,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-fieldsep_zero">
           <term><literal>fieldsep_zero</literal></term>
           <listitem>
           <para>
@@ -2945,7 +2945,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-footer">
           <term><literal>footer</literal></term>
           <listitem>
           <para>
@@ -2959,7 +2959,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-format">
           <term><literal>format</literal></term>
           <listitem>
           <para>
@@ -3036,7 +3036,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-linestyle">
           <term><literal>linestyle</literal></term>
           <listitem>
           <para>
@@ -3087,7 +3087,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-null">
           <term><literal>null</literal></term>
           <listitem>
           <para>
@@ -3099,7 +3099,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-numericlocale">
           <term><literal>numericlocale</literal></term>
           <listitem>
           <para>
@@ -3113,7 +3113,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-pager">
           <term><literal>pager</literal></term>
           <listitem>
           <para>
@@ -3148,7 +3148,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>
@@ -3160,7 +3160,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-recordsep">
           <term><literal>recordsep</literal></term>
           <listitem>
           <para>
@@ -3170,7 +3170,7 @@ lo_import 152801
           </listitem>
           </varlistentry>
 
-          <varlistentry>
+          <varlistentry id="app-psql-meta-command-pset-recordsep_zero">
           <term><literal>recordsep_zero</literal></term>
           <listitem>
           <para>
@@ -3180,7 +3180,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>
@@ -3204,7 +3204,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>
@@ -3216,7 +3216,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>
@@ -3232,7 +3232,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>
@@ -3243,7 +3243,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>
@@ -3254,7 +3254,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>
@@ -3285,7 +3285,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-quit">
         <term><literal>\q</literal> or <literal>\quit</literal></term>
         <listitem>
         <para>
@@ -3296,7 +3296,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>
@@ -3308,7 +3308,7 @@ lo_import 152801
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-reset">
         <term><literal>\r</literal> or <literal>\reset</literal></term>
         <listitem>
         <para>
@@ -3318,7 +3318,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>
@@ -3334,7 +3334,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>
@@ -3374,7 +3374,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>
@@ -3391,7 +3391,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>
@@ -3426,7 +3426,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>
@@ -3452,7 +3452,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>
@@ -3464,7 +3464,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>
@@ -3478,7 +3478,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>
@@ -3492,7 +3492,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>
@@ -3511,7 +3511,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>
@@ -3535,7 +3535,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>
@@ -3547,7 +3547,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>
@@ -3565,7 +3565,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>
@@ -3576,7 +3576,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-z">
         <term><literal>\z[S] [ <link linkend="app-psql-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
         <listitem>
         <para>
@@ -3597,7 +3597,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>
@@ -3617,7 +3617,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>
@@ -3634,7 +3634,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
       </varlistentry>
 
 
-      <varlistentry>
+      <varlistentry id="app-psql-meta-command-semicolon">
         <term><literal>\;</literal></term>
         <listitem>
         <para>
@@ -3858,7 +3858,7 @@ bar
    </para>
 
     <variablelist>
-      <varlistentry>
+      <varlistentry id="app-psql-variables-autocommit">
       <term>
        <varname>AUTOCOMMIT</varname>
        <indexterm>
@@ -3902,7 +3902,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-comp_keyword_case">
         <term><varname>COMP_KEYWORD_CASE</varname></term>
         <listitem>
         <para>
@@ -3918,7 +3918,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-dbname">
         <term><varname>DBNAME</varname></term>
         <listitem>
         <para>
@@ -3929,7 +3929,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-echo">
         <term><varname>ECHO</varname></term>
         <listitem>
         <para>
@@ -3948,7 +3948,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-echo_hidden">
         <term><varname>ECHO_HIDDEN</varname></term>
         <listitem>
         <para>
@@ -3965,7 +3965,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-encoding">
         <term><varname>ENCODING</varname></term>
         <listitem>
         <para>
@@ -3977,7 +3977,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-error">
        <term><varname>ERROR</varname></term>
        <listitem>
         <para>
@@ -3987,7 +3987,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-fetch_count">
         <term><varname>FETCH_COUNT</varname></term>
         <listitem>
         <para>
@@ -4015,7 +4015,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-hide_tableam">
         <term><varname>HIDE_TABLEAM</varname></term>
         <listitem>
         <para>
@@ -4026,7 +4026,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-hide_toast_compression">
         <term><varname>HIDE_TOAST_COMPRESSION</varname></term>
         <listitem>
         <para>
@@ -4037,7 +4037,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-histcontrol">
         <term><varname>HISTCONTROL</varname></term>
         <listitem>
         <para>
@@ -4058,7 +4058,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-histfile">
         <term><varname>HISTFILE</varname></term>
         <listitem>
         <para>
@@ -4084,7 +4084,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-histsize">
         <term><varname>HISTSIZE</varname></term>
         <listitem>
         <para>
@@ -4100,7 +4100,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-host">
         <term><varname>HOST</varname></term>
         <listitem>
         <para>
@@ -4111,7 +4111,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-ignoreeof">
         <term><varname>IGNOREEOF</varname></term>
         <listitem>
         <para>
@@ -4132,7 +4132,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-lastoid">
         <term><varname>LASTOID</varname></term>
         <listitem>
         <para>
@@ -4148,7 +4148,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>
@@ -4161,7 +4161,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-on_error_rollback">
       <term>
        <varname>ON_ERROR_ROLLBACK</varname>
        <indexterm>
@@ -4185,7 +4185,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-on_error_stop">
         <term><varname>ON_ERROR_STOP</varname></term>
         <listitem>
         <para>
@@ -4204,7 +4204,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-port">
         <term><varname>PORT</varname></term>
         <listitem>
         <para>
@@ -4215,7 +4215,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>
@@ -4228,7 +4228,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-quiet">
         <term><varname>QUIET</varname></term>
         <listitem>
         <para>
@@ -4239,7 +4239,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-row_count">
        <term><varname>ROW_COUNT</varname></term>
        <listitem>
         <para>
@@ -4249,7 +4249,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>
@@ -4264,7 +4264,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-show_all_results">
         <term><varname>SHOW_ALL_RESULTS</varname></term>
         <listitem>
         <para>
@@ -4276,7 +4276,7 @@ bar
         </listitem>
       </varlistentry>
 
-       <varlistentry>
+      <varlistentry id="app-psql-variables-show_context">
         <term><varname>SHOW_CONTEXT</varname></term>
         <listitem>
         <para>
@@ -4294,7 +4294,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-singleline">
         <term><varname>SINGLELINE</varname></term>
         <listitem>
         <para>
@@ -4304,7 +4304,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-singlestep">
         <term><varname>SINGLESTEP</varname></term>
         <listitem>
         <para>
@@ -4314,7 +4314,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-sqlstate">
        <term><varname>SQLSTATE</varname></term>
        <listitem>
         <para>
@@ -4325,7 +4325,7 @@ bar
        </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-user">
         <term><varname>USER</varname></term>
         <listitem>
         <para>
@@ -4336,7 +4336,7 @@ bar
         </listitem>
       </varlistentry>
 
-      <varlistentry>
+      <varlistentry id="app-psql-variables-verbosity">
         <term><varname>VERBOSITY</varname></term>
         <listitem>
         <para>
@@ -4350,7 +4350,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>
@@ -4479,7 +4479,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>
@@ -4493,7 +4493,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>
@@ -4504,12 +4504,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>
@@ -4521,18 +4521,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>
@@ -4545,14 +4545,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>
@@ -4575,7 +4575,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>
@@ -4588,7 +4588,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>
@@ -4597,7 +4597,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>
@@ -4606,7 +4606,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>
@@ -4617,7 +4617,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>
@@ -4628,7 +4628,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>
@@ -4650,7 +4650,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>
@@ -4750,7 +4750,7 @@ $endif
 
   <variablelist>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-columns">
     <term><envar>COLUMNS</envar></term>
 
     <listitem>
@@ -4763,7 +4763,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>
@@ -4776,7 +4776,7 @@ $endif
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-pg_color">
     <term><envar>PG_COLOR</envar></term>
     <listitem>
      <para>
@@ -4787,7 +4787,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>
@@ -4804,7 +4804,7 @@ $endif
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psql_editor_linenumber_arg">
     <term><envar>PSQL_EDITOR_LINENUMBER_ARG</envar></term>
 
     <listitem>
@@ -4832,7 +4832,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psql_history">
     <term><envar>PSQL_HISTORY</envar></term>
 
     <listitem>
@@ -4842,7 +4842,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>
 
@@ -4863,7 +4863,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>
@@ -4881,7 +4881,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-psqlrc">
     <term><envar>PSQLRC</envar></term>
 
     <listitem>
@@ -4891,7 +4891,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-shell">
     <term><envar>SHELL</envar></term>
 
     <listitem>
@@ -4901,7 +4901,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="app-psql-environment-tmpdir">
     <term><envar>TMPDIR</envar></term>
 
     <listitem>
@@ -4926,7 +4926,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>
@@ -4974,7 +4974,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 e0a6f775b6..0db36aee2f 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>
#16Brar Piening
brar@gmx.de
In reply to: vignesh C (#14)
Re: doc: add missing "id" attributes to extension packaging page

On 09.01.2023 at 03:38, vignesh C wrote:

There are couple of commitfest entries for this:
https://commitfest.postgresql.org/41/4041/
https://commitfest.postgresql.org/41/4042/ Can one of them be closed?

I've split the initial patch into two parts upon Álvaro's request in [1]/messages/by-id/20221206083809.3kaygnh2xswoxslj@alvherre.pgsql
so that we can discuss them separately

https://commitfest.postgresql.org/41/4041/ is tracking the patch you've
been trying to apply and that I've just sent a rebased version for. It
only adds (invisible) ids to the HTML documentation and can be closed
once you've applied the patch.
https://commitfest.postgresql.org/41/4042/ is tracking a different patch
that makes the ids and the corresponding links discoverable at the HTML
surface. Hover one of the psql options in [2]https://pgdocs.piening.info/app-psql.html#APP-PSQL-OPTION-PORT to see the behavior. This
one still needs reviewing and there is no discussion around it yet.

Regards,
Brar

[1]: /messages/by-id/20221206083809.3kaygnh2xswoxslj@alvherre.pgsql
/messages/by-id/20221206083809.3kaygnh2xswoxslj@alvherre.pgsql
[2]: https://pgdocs.piening.info/app-psql.html#APP-PSQL-OPTION-PORT

#17Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#15)
Re: doc: add missing "id" attributes to extension packaging page

On Mon, 9 Jan 2023 08:09:02 +0100
Brar Piening <brar@gmx.de> wrote:

On 09.01.2023 at 03:31, vignesh C wrote:

The patch does not apply on top of HEAD as in [1], please post a
rebased patch:

This one applies on top of 3c569049b7b502bb4952483d19ce622ff0af5fd6
and the documentation build succeeds. Beyond rebasing I've added a
few more ids (to make the other patch
(make_html_ids_discoverable.patch) build without warnings again) but
nothing that would justify another review.

Agreed. I believe that as long as your system has xmllint installed
and the documentation builds there's not a lot that can go wrong.
This patch only adds lots-of-id attributes.

We probably have to move quickly with this patch since it touches
pretty much any file in the documentation and will be outdated in a
minute.

+1

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#18Tom Lane
tgl@sss.pgh.pa.us
In reply to: Brar Piening (#16)
Re: doc: add missing "id" attributes to extension packaging page

Brar Piening <brar@gmx.de> writes:

On 09.01.2023 at 03:38, vignesh C wrote:

There are couple of commitfest entries for this:
https://commitfest.postgresql.org/41/4041/
https://commitfest.postgresql.org/41/4042/ Can one of them be closed?

I've split the initial patch into two parts upon Álvaro's request in [1]
so that we can discuss them separately

It's not great to have multiple CF entries pointing at the same email
thread --- it confuses both people and bots. Next time please split
off a thread for each distinct patch.

I pushed the ID-addition patch, with a few fixes:

* AFAIK our practice is to use "-" never "_" in XML ID attributes.
You weren't very consistent about that even within this patch, and
the overall effect would have been to have no standard about that
at all, which doesn't seem great. I changed them all to "-".

* I got rid of a couple of "-et-al" additions, because it did not
seem like a good precedent. That would tempt people to modify
existing ID tags when adding variables to an entry, which'd defeat
the purpose I think.

* I fixed a couple of things that looked like typos or unnecessary
inconsistencies. I have to admit that my eyes glazed over after
awhile, so there might be remaining infelicities.

It's probably going to be necessary to have follow-on patches,
because I'm sure there is stuff in the pipeline that adds more
ID-less tags. Or do we have a way to create warnings about that?

I'm unqualified to review CSS stuff, so you'll need to get somebody
else to review that patch. But I'd suggest reposting it, else
the cfbot is going to start whining that the patch-of-record in
this thread no longer applies.

regards, tom lane

#19Karl O. Pinc
kop@karlpinc.com
In reply to: Tom Lane (#18)
Re: doc: add missing "id" attributes to extension packaging page

On Mon, 09 Jan 2023 15:18:18 -0500
Tom Lane <tgl@sss.pgh.pa.us> wrote:

I pushed the ID-addition patch, with a few fixes:

* AFAIK our practice is to use "-" never "_" in XML ID attributes.
You weren't very consistent about that even within this patch, and
the overall effect would have been to have no standard about that
at all, which doesn't seem great. I changed them all to "-".

Apologies for not catching this.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#20Karl O. Pinc
kop@karlpinc.com
In reply to: Tom Lane (#18)
Re: doc: add missing "id" attributes to extension packaging page

On Mon, 09 Jan 2023 15:18:18 -0500
Tom Lane <tgl@sss.pgh.pa.us> wrote:

Brar Piening <brar@gmx.de> writes:

On 09.01.2023 at 03:38, vignesh C wrote:

There are couple of commitfest entries for this:
https://commitfest.postgresql.org/41/4041/
https://commitfest.postgresql.org/41/4042/ Can one of them be
closed?

I've split the initial patch into two parts upon Álvaro's request
in [1] so that we can discuss them separately

I pushed the ID-addition patch, with a few fixes:

It's probably going to be necessary to have follow-on patches,
because I'm sure there is stuff in the pipeline that adds more
ID-less tags. Or do we have a way to create warnings about that?

I am unclear on how to make warnings with xslt. You can make
a listing of problems, but who would read it if the build
completed successfully? You can make errors and abort.

But my xslt and docbook and pg-docs-fu are a bit stale.

I think there's more to comment on regards the xslt in the
other patch, but I'll wait for the new thread for that patch.
That might be where there should be warnings raised, etc.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#21Tom Lane
tgl@sss.pgh.pa.us
In reply to: Karl O. Pinc (#20)
Re: doc: add missing "id" attributes to extension packaging page

"Karl O. Pinc" <kop@karlpinc.com> writes:

I think there's more to comment on regards the xslt in the
other patch, but I'll wait for the new thread for that patch.
That might be where there should be warnings raised, etc.

We can continue using this thread, now that the other commit is in.

regards, tom lane

#22Brar Piening
brar@gmx.de
In reply to: Tom Lane (#18)
Re: doc: add missing "id" attributes to extension packaging page

On 09.01.2023 at 21:18, Tom Lane wrote:

It's not great to have multiple CF entries pointing at the same email
thread --- it confuses both people and bots. Next time please split
off a thread for each distinct patch.

I agree. I had overestimated the cfbot's ability to handle branched
threads. I'll create separate threads next time.

* AFAIK our practice is to use "-" never "_" in XML ID attributes.
You weren't very consistent about that even within this patch, and
the overall effect would have been to have no standard about that
at all, which doesn't seem great. I changed them all to "-".

Noted. Maybe it's worth to write a short paragraph about Ids and their
style somewhere in the docs (e.g.  Appendix J.5).

* I got rid of a couple of "-et-al" additions, because it did not
seem like a good precedent. That would tempt people to modify
existing ID tags when adding variables to an entry, which'd defeat
the purpose I think.

I tried to use it sparsely, mostly where a varlistentry had multiple
child items and I had arbitrarily pick one of them. It's not important,
though. I'm curious how you solved this.

* I fixed a couple of things that looked like typos or unnecessary
inconsistencies. I have to admit that my eyes glazed over after
awhile, so there might be remaining infelicities.

I'm all for consistency. The only places where I intentionally refrained
from being consistent was where I felt Ids would get too long or where
there were already ids in place that didn't match my naming scheme.

It's probably going to be necessary to have follow-on patches,
because I'm sure there is stuff in the pipeline that adds more
ID-less tags. Or do we have a way to create warnings about that?

Agreed. And yes, we do have a limited way to create warnings (that's
part of the other patch).

I'm unqualified to review CSS stuff, so you'll need to get somebody
else to review that patch. But I'd suggest reposting it, else
the cfbot is going to start whining that the patch-of-record in
this thread no longer applies.

I will do that. Thanks for your feedback!

Regards,

Brar

#23Tom Lane
tgl@sss.pgh.pa.us
In reply to: Brar Piening (#22)
Re: doc: add missing "id" attributes to extension packaging page

Brar Piening <brar@gmx.de> writes:

On 09.01.2023 at 21:18, Tom Lane wrote:

* I got rid of a couple of "-et-al" additions, because it did not
seem like a good precedent. That would tempt people to modify
existing ID tags when adding variables to an entry, which'd defeat
the purpose I think.

I tried to use it sparsely, mostly where a varlistentry had multiple
child items and I had arbitrarily pick one of them. It's not important,
though. I'm curious how you solved this.

I just removed "-et-al", I didn't question your choice of the principal
variable name. As you say, it didn't seem to matter that much.

regards, tom lane

#24Brar Piening
brar@gmx.de
In reply to: Karl O. Pinc (#20)
Re: doc: add missing "id" attributes to extension packaging page

On 09.01.2023 at 23:28, Karl O. Pinc wrote:

On Mon, 09 Jan 2023 15:18:18 -0500
Tom Lane <tgl@sss.pgh.pa.us> wrote:

It's probably going to be necessary to have follow-on patches,
because I'm sure there is stuff in the pipeline that adds more
ID-less tags. Or do we have a way to create warnings about that?

I am unclear on how to make warnings with xslt. You can make
a listing of problems, but who would read it if the build
completed successfully? You can make errors and abort.

You can emit warnings to the command line or you can abort with an
error. I've opted for warnings + comments in the output in the styling
patch.

The biggest issue about errors and warnings is the fact that xslt does
not process files in a line-based way which makes it pretty much
impossible to give hints where the problem causing the warning is
located. Since everything is bound together via XML entities, you can't
even tell the source file.

I've worked around this by also emitting an HTML comment to the output
so that I can find a somewhat unique string next to it and the grep the
documentation sources for this string. It's a bit ugly but the best I
could come up with.

I'll repost a rebased version of the styling patch in a minute.

Regards,

Brar

#25Brar Piening
brar@gmx.de
In reply to: Brar Piening (#24)
1 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On 10.01.2023 at 06:28, Brar Piening wrote:

I'll repost a rebased version of the styling patch in a minute.

After checking that there's no need for rebasing I'm reposting the
original patch here, to make cfbot pick it up as the latest one in a
somewhat screwed up thread mixing two patches (sorry for that - won't
happen again).

Althoug the patch is pretty compact you probably need some understanding
of both XSLT and CSS to understand and judge the changes it introduces.

It pretty much does two things:

1. Make html ids discoverable in the browser by adding a link with a
hover effect to items sections and varlistentries that have an id.
Hover one of the psql options and click on the hash mark in [1]https://pgdocs.piening.info/app-psql.html#APP-PSQL-OPTION-PORT to
see the behavior.
2. Emit a warning to the command line and a comment to the HTML output
when the docs build runs into a section without id or a varlistentry
without id where at least one entry in the varlist already has an id.

The original mail for the patch is at [2]/messages/by-id/d6695820-af71-5e84-58b0-ff9f1c189603@gmx.de, the commitfest entry is at
[3]: https://commitfest.postgresql.org/41/4042/

Regards,

Brar

[1]: https://pgdocs.piening.info/app-psql.html#APP-PSQL-OPTION-PORT

[2]: /messages/by-id/d6695820-af71-5e84-58b0-ff9f1c189603@gmx.de
/messages/by-id/d6695820-af71-5e84-58b0-ff9f1c189603@gmx.de

[3]: https://commitfest.postgresql.org/41/4042/

[4]: /messages/by-id/4364ab38-a475-a1fc-b104-ecd6c72010d0@enterprisedb.com
/messages/by-id/4364ab38-a475-a1fc-b104-ecd6c72010d0@enterprisedb.com

Attachments:

make_html_ids_discoverable.patchtext/plain; charset=UTF-8; name=make_html_ids_discoverable.patchDownload
diff --git a/doc/src/sgml/stylesheet-html-common.xsl b/doc/src/sgml/stylesheet-html-common.xsl
index 9df2782ce4..111b03d6fc 100644
--- a/doc/src/sgml/stylesheet-html-common.xsl
+++ b/doc/src/sgml/stylesheet-html-common.xsl
@@ -301,4 +301,115 @@ set       toc,title
   </xsl:choose>
 </xsl:template>
 
+
+<!-- Overridden template to add links to ids in varlists -->
+<xsl:template match="varlistentry">
+  <dt>
+    <xsl:call-template name="id.attribute"/>
+    <xsl:call-template name="anchor"/>
+    <xsl:apply-templates select="term"/>
+    <xsl:call-template name="pg.id.link"/>
+  </dt>
+  <dd>
+    <xsl:apply-templates select="listitem"/>
+  </dd>
+</xsl:template>
+
+<!-- Overridden template to add links to ids in sections -->
+<xsl:template name="section.heading">
+  <xsl:param name="section" select="."/>
+  <xsl:param name="level" select="1"/>
+  <xsl:param name="allow-anchors" select="1"/>
+  <xsl:param name="title"/>
+  <xsl:param name="class" select="'title'"/>
+
+  <xsl:variable name="id">
+    <xsl:choose>
+      <!-- Make sure the subtitle doesn't get the same id as the title -->
+      <xsl:when test="self::subtitle">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="."/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- if title is in an *info wrapper, get the grandparent -->
+      <xsl:when test="contains(local-name(..), 'info')">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="../.."/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select=".."/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- HTML H level is one higher than section level -->
+  <xsl:variable name="hlevel">
+    <xsl:choose>
+      <!-- highest valid HTML H level is H6; so anything nested deeper
+           than 5 levels down just becomes H6 -->
+      <xsl:when test="$level &gt; 5">6</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$level + 1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
+    <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
+    <xsl:if test="$css.decoration != '0'">
+      <xsl:if test="$hlevel&lt;3">
+        <xsl:attribute name="style">clear: both</xsl:attribute>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="$allow-anchors != 0">
+      <xsl:call-template name="anchor">
+        <xsl:with-param name="node" select="$section"/>
+        <xsl:with-param name="conditional" select="0"/>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:copy-of select="$title"/>
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="$section"/>
+    </xsl:call-template>
+  </xsl:element>
+</xsl:template>
+
+<!-- Creates a link pointing to an id within the document -->
+<xsl:template name="pg.id.link">
+  <xsl:param name="object" select="."/>
+  <xsl:choose>
+    <xsl:when test="$object/@id or $object/@xml:id">
+      <a>
+        <xsl:attribute name="href">
+          <xsl:text>#</xsl:text>
+          <xsl:call-template name="object.id">
+            <xsl:with-param name="object" select="$object"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="class">
+          <xsl:text>id_link</xsl:text>
+        </xsl:attribute>
+        <xsl:text> #</xsl:text>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- Only complain about varlistentries if at least one entry in the list has an id -->
+      <xsl:if test="name($object) != 'varlistentry' or $object/parent::variablelist/varlistentry[@id]">
+        <xsl:message terminate="no">
+          <xsl:value-of select ="name($object)"/>
+          <xsl:text> element without id. Please add an id to make it usable</xsl:text>
+          <xsl:text> as stable anchor in the public HTML documentation.</xsl:text>
+        </xsl:message>
+        <xsl:comment>
+          <xsl:text>Please add an id to the </xsl:text>
+          <xsl:value-of select ="name($object)"/>
+          <xsl:text> element in the sgml source code.</xsl:text>
+        </xsl:comment>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index 6410a47958..e4174e0613 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -163,3 +163,13 @@ acronym		{ font-style: inherit; }
     width: 75%;
   }
 }
+
+/* Links to ids of headers and definition terms */
+a.id_link {
+        color: inherit;
+        visibility: hidden;
+}
+
+*:hover > a.id_link {
+        visibility: visible;
+}
#26Peter Eisentraut
peter.eisentraut@enterprisedb.com
In reply to: Tom Lane (#18)
Re: doc: add missing "id" attributes to extension packaging page

On 09.01.23 21:18, Tom Lane wrote:

* AFAIK our practice is to use "-" never "_" in XML ID attributes.
You weren't very consistent about that even within this patch, and
the overall effect would have been to have no standard about that
at all, which doesn't seem great. I changed them all to "-".

In the olden says, "_" was invalid in ID attribute values. This is no
longer the case. But of course it's good to stay consistent with
existing practice where reasonable.

#27Karl O. Pinc
kop@karlpinc.com
In reply to: Peter Eisentraut (#26)
Re: doc: add missing "id" attributes to extension packaging page

Hi Brar,

Here's my first review of the make_html_ids_discoverable.patch.

Overall:

To start with, I'd like to say I like the goal and how everything
works when the patch is applied. I was a bit skeptical, thinking that
the whole thing was going to be distracting when reading the docs or
otherwise odd, but it really works.

The thought comes to mind to take accessibility into account. I am
unclear on what that would mean in this case.

Regards CSS:

The CSS looks good. Also, it passes the W3C CSS validator (
https://jigsaw.w3.org/css-validator/) for CSS level 3.

Regards XSLT:

I believe the XSLT needs work.

Without really knowing the style of PG's XSLT, I'm going to suggest
putting the comment
<!-- Make HTML ids discoverable (by hover) by adding links to the ids -->
above the new XSLT. Precede the comment with 2 blank lines and follow
it by one blank line. The idea is to make the code you're adding an
identifiable "separate section".

I have a question, it is the docbook html stylesheets for XML that are
being overridden? It looks like it, and what else would it be, but....
(Sorry, I'm a bit stale on this stuff.)

I believe that overriding the XSLT by copying the original and making
modifications is the "wrong way" (TM). I think that the right way is
to declare a xsl:default-mode somewhere in the stylesheets. There
does not seem to be one, so the default mode for PG doc processing
could be something like "postgres-mode". And I'd expect it to be
declared somewhere right at the top of the xml hierarchy. (I forget
what that is, probably something like "document" or "book" or
something.) Then, you'd write your for the <xsl:template
match="varlistentry"> and <xsl:template name="section.heading"> with a
mode of "postgres-mode", and have your templates call the "traditional
default", "modeless", templates. That way your not copying and
patching upstream code, but are instead, in effect, calling it as a
subroutine.

This should work especially well since, I think, you're just adding
new output to what the upstream templates do. You're not trying to
insert new output into the middle of the stock output or otherwise
modify the stock output.

You're adding only about 6 lines of XSLT to the upstream templates,
and copying 100+ lines. There must be a better way.

See: https://www.w3.org/TR/xslt-30/#modes

I've never tried this, although I do recall doing something or another
with modes in the past. And I've not gone so far as to figure out
(again?) how to call a "modeless template", so you can invoke the
original, upstream, templates. And setting a default mode seems like
something of a "big hammer", so should probably be checked over by
someone who's more steeped in Postgres docs than myself. (Like a
committer. :) But I believe it is the way to go. To make it work
you'll need to figure out the XSLT mode selection process and make
sure that it first selects the "postgres-mode", and then the modeless
templates, and also still works right when a template calls another
and explicitly sets a mode.

Regards visual presentation:

Here's the fun question, what to have "appear" when a section or
varlistentry with an id is hovered over?

I kind of like your choice of the "#" character as the screen element
that becomes visible when you hover over a section or varlistentry
with the mouse, which then shows you the URL of the thing over which
you are hovering. That's what's in the patch now. But I wonder why
you chose it. Is there some sort of standard? I've seen the anchor
Unicode character before, (⚓) \u2693. I don't find it particularly
helpful. The "place of interest" symbol,(⌘) \u2318, might be nice.
There is (◎), \u25ce, the "bullseye" symbol. There is the link symbol
(🔗), \U0001f517. Like the anchor, it has generally been confusing
when I come across it. The link symbol with the "text variant form",
(🔗︎) \U0001f517\ufe0e, looks more link an actual chain and is somewhat
better. (The opposite of "text variant" is "emoji variant".) There
is also the paperclip, (📎) \U0001f4ce. And the paperclip text
variant, (📎︎) \U0001f4ce\ufe0e.

Of all the Unicode choices above, I think I prefer the last. The text
paperclip. 📎︎

(The hex representations above are Python 3 string literals. So
print("\U0001f4ce\ufe0e") prints the text paperclip.)

The actual representation of the various Unicode characters is going
to depend on the font. (Things change for me when looked at in an
email v.s. in a browser.)

The question I have is should we use "Unicode icons" at all or is
plain old UTF-8 good enough for us (because it was good enough for our
ancestors ;) ? Of course an image is also possible.... For now I'm
not going to advocate for a change from the "#" already used in the
patch.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#28Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#27)
Re: doc: add missing "id" attributes to extension packaging page

On Sun, 15 Jan 2023 18:01:50 -0600
"Karl O. Pinc" <kop@karlpinc.com> wrote:

Regards XSLT:

I believe the XSLT needs work.

I also think that the XSLT should error and halt
when there's no id (in the expected places).
Instead of just giving a warning and keeping going. Otherwise
they'll constantly be ignored warnings and periodically
there will have to be patches to supply missing ids.

To solve the "which id is missing where so I can fix it"
problem, I propose the error text show the chapter title,
all the enclosing sub-section titles, and any previous existing
varlistentry ids occurring before the tag with the
missing attribute. At least for varlistentry-s. For
sections you could do chapter and enclosing sub-section
titles and the title of the section with the problem.
That should be enough for an author to find the place
in the source sgml that needs fixing.

Maybe, possibly, you can see how this is done by looking
at whatever XSLT there is that automatically generates
ids for sections without ids, so that the table of contents
have something to link to. In any case, XSLT is really
good at "looking at" parent/enclosing XML, so producing
a useful error message shouldn't be _that_ hard. I've
definitely done this sort of thing before so I can tell you
it's readily doable.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#29Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#27)
Re: doc: add missing "id" attributes to extension packaging page

On Sun, 15 Jan 2023 18:01:50 -0600
"Karl O. Pinc" <kop@karlpinc.com> wrote:

Regards XSLT:

I believe the XSLT needs work.

I believe that overriding the XSLT by copying the original and making
modifications is the "wrong way" (TM). I think that the right way is
to declare a xsl:default-mode somewhere in the stylesheets. There
does not seem to be one, so the default mode for PG doc processing
could be something like "postgres-mode". And I'd expect it to be
declared somewhere right at the top of the xml hierarchy. (I forget
what that is, probably something like "document" or "book" or
something.) Then, you'd write your for the <xsl:template
match="varlistentry"> and <xsl:template name="section.heading"> with
a mode of "postgres-mode", and have your templates call the
"traditional default", "modeless", templates. That way your not
copying and patching upstream code, but are instead, in effect,
calling it as a subroutine.

This should work especially well since, I think, you're just adding
new output to what the upstream templates do. You're not trying to
insert new output into the middle of the stock output or otherwise
modify the stock output.

You're adding only about 6 lines of XSLT to the upstream templates,
and copying 100+ lines. There must be a better way.

See: https://www.w3.org/TR/xslt-30/#modes

I've never tried this, although I do recall doing something or another
with modes in the past. And I've not gone so far as to figure out
(again?) how to call a "modeless template", so you can invoke the
original, upstream, templates. And setting a default mode seems like
something of a "big hammer", so should probably be checked over by
someone who's more steeped in Postgres docs than myself. (Like a
committer. :) But I believe it is the way to go. To make it work
you'll need to figure out the XSLT mode selection process and make
sure that it first selects the "postgres-mode", and then the modeless
templates, and also still works right when a template calls another
and explicitly sets a mode.

Drat. I forgot. We're using xsltproc which is XSLT 1.0.

So this is the relevant spec:

https://www.w3.org/TR/1999/REC-xslt-19991116#modes

In XSLT 1.0 there is no xml:default-mode. So I _think_ what you do then
is modify the built-in template rules so that the (default) template
(mode='') is invoked when there is no 'postgres-mode' version of the
template, but otherwise the 'postgres-mode' version of the template
is invoked. Your 'postgres-mode' templates will xsl:call-template
the default template, adding whatever they want to the output produced
by the default template.

See: https://www.w3.org/TR/1999/REC-xslt-19991116#built-in-rule

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#30Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#29)
Re: doc: add missing "id" attributes to extension packaging page

On Mon, 16 Jan 2023 11:14:35 -0600
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Sun, 15 Jan 2023 18:01:50 -0600
"Karl O. Pinc" <kop@karlpinc.com> wrote:

Regards XSLT:

I believe the XSLT needs work.

In XSLT 1.0 there is no xml:default-mode. So I _think_ what you do
then is modify the built-in template rules so that the (default)
template (mode='') is invoked when there is no 'postgres-mode'
version of the template, but otherwise the 'postgres-mode' version of
the template is invoked. Your 'postgres-mode' templates will
xsl:call-template the default template, adding whatever they want to
the output produced by the default template.

Or maybe the right way is to set a mode at the very top,
the first apply-templates call, and not mess with the
built-in templates at all. (You'd write your own
"postgres-mode" templates the same way, to "wrap"
and call the default templates.)

Think of the mode as an implicit argument that's preserved and
passed down through each template invocation without having to
be explicitly specified by the calling code.

Regards

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#31Brar Piening
brar@gmx.de
In reply to: Karl O. Pinc (#30)
Re: doc: add missing "id" attributes to extension packaging page

On 17.01.2023 at 02:05, Karl O. Pinc wrote:

Or maybe the right way is to set a mode at the very top,
the first apply-templates call, and not mess with the
built-in templates at all. (You'd write your own
"postgres-mode" templates the same way, to "wrap"
and call the default templates.)

Think of the mode as an implicit argument that's preserved and
passed down through each template invocation without having to
be explicitly specified by the calling code.

I think the document you're missing is [1]http://www.sagehill.net/docbookxsl/CustomizingPart.html.

There are multiple ways to customize DocBook XSL output and it sounds
like you want me to write a customization layer which I didn't do
because there is precedent that the typical "way to do it" (TM) in the
PostgreSQL project is [2]http://www.sagehill.net/docbookxsl/ReplaceTemplate.html.

Regards,

Brar

[1]: http://www.sagehill.net/docbookxsl/CustomizingPart.html
[2]: http://www.sagehill.net/docbookxsl/ReplaceTemplate.html

#32Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#31)
Re: doc: add missing "id" attributes to extension packaging page

On Tue, 17 Jan 2023 06:57:23 +0100
Brar Piening <brar@gmx.de> wrote:

On 17.01.2023 at 02:05, Karl O. Pinc wrote:

Or maybe the right way is to set a mode at the very top,
the first apply-templates call, and not mess with the
built-in templates at all. (You'd write your own
"postgres-mode" templates the same way, to "wrap"
and call the default templates.)

Think of the mode as an implicit argument that's preserved and
passed down through each template invocation without having to
be explicitly specified by the calling code.

I think the document you're missing is [1].

There are multiple ways to customize DocBook XSL output and it sounds
like you want me to write a customization layer which I didn't do
because there is precedent that the typical "way to do it" (TM) in the
PostgreSQL project is [2].

Regards,

Brar

[1] http://www.sagehill.net/docbookxsl/CustomizingPart.html
[2] http://www.sagehill.net/docbookxsl/ReplaceTemplate.html

Sagehill is normally vary good. But in this case [2] does not
apply. Or rather it applies but it is overkill because you
do not want to replace what a template is producing. You
want to add to what a template is producing. So you want to
wrap the template, with your new code adding output before/
after what the original produces.

[1]: does not contain this technique.

If you're not willing to try I am willing to see if I can
produce an example to work from. My XSLT is starting to
come back.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#33Brar Piening
brar@gmx.de
In reply to: Karl O. Pinc (#32)
Re: doc: add missing "id" attributes to extension packaging page

On 17.01.2023 at 14:12, Karl O. Pinc wrote:

If you're not willing to try I am willing to see if I can
produce an example to work from. My XSLT is starting to
come back.

I'm certainly willing to try but I'd appreciate an example in any case.

My XSLT skills are mostly learning by doing combined with trial and error.

Regards,

Brar

#34Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#33)
1 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On Tue, 17 Jan 2023 19:13:38 +0100
Brar Piening <brar@gmx.de> wrote:

On 17.01.2023 at 14:12, Karl O. Pinc wrote:

If you're not willing to try I am willing to see if I can
produce an example to work from. My XSLT is starting to
come back.

I'm certainly willing to try but I'd appreciate an example in any
case.

It's good you asked. After poking about the XSLT 1.0 spec to refresh
my memory I abandoned the "mode" approach entirely. The real "right
way" is to use the import mechanism.

I've attached a patch that "wraps" the section.heading template
and adds extra stuff to the HTML output generated by the stock
template. (example_section_heading_override.patch)

There's a bug. All that goes into the html is a comment, not
a hoverable link. But the technique is clear.

On my system (Debian 11, bullseye) I found the URI to import
by looking at:
/usr/share/xml/docbook/stylesheet/docbook-xsl/catalog.xml
(Which is probably the right place to look.)
Ultimately, that file is findable via: /etc/xml/catalog
The "best way" on
Debian is: /usr/share/doc/docbook-xsl/README.gz
In other words, the README that comes with the style sheets.

Supposedly, the href=URLs are really URIs and will be good
no matter what/when. The XSLT processor should know to look
at the system catalogs and read the imported style sheet
from the local file system.

It might be useful to add --nonet to the xsltproc invocation(s)
in the Makefile(s). Just in case; to keep from retrieving
stylesheets from the net. (If the option is not already there.
I didn't look.)

If this is the first time that PG uses the XSLT import mechanism
I imagine that "things could go wrong" depending on what sort
of system is being used to build the docs. I'm not worried,
but it is something to note for the committer.

My XSLT skills are mostly learning by doing combined with trial and
error.

I think of XSLT as a functional programming language. Recursion is
a big deal, and data directed programming can be a powerful technique
because XSLT is so good with data structures.
(https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book-Z-H-17.html#%_sec_2.4.3)

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

example_section_heading_overrride.patchtext/x-patchDownload
diff --git a/doc/src/sgml/stylesheet-html-common.xsl b/doc/src/sgml/stylesheet-html-common.xsl
index 9df2782ce4..88e084e190 100644
--- a/doc/src/sgml/stylesheet-html-common.xsl
+++ b/doc/src/sgml/stylesheet-html-common.xsl
@@ -12,6 +12,10 @@
   all HTML output variants (chunked and single-page).
   -->
 
+<!-- Imports - to override stylesheet templates -->
+<xsl:import
+    href="http://cdn.docbook.org/release/xsl/current/html/sections.xsl"/>
+
 <!-- Parameters -->
 <xsl:param name="make.valid.html" select="1"></xsl:param>
 <xsl:param name="generate.id.attributes" select="1"></xsl:param>
@@ -301,4 +305,53 @@ set       toc,title
   </xsl:choose>
 </xsl:template>
 
+<!-- Override the standard section heading generation to add an id link -->
+<xsl:template name="section.heading">
+  <xsl:param name="section" select="."/>
+  <xsl:param name="level" select="1"/>
+  <xsl:param name="allow-anchors" select="1"/>
+  <xsl:param name="title"/>
+  <xsl:param name="class" select="'title'"/>
+  <xsl:apply-imports/>
+  <xsl:call-template name="pg.id.link">
+    <xsl:with-param name="object" select="$section"/>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- Creates a link pointing to an id within the document -->
+<xsl:template name="pg.id.link">
+  <xsl:param name="object" select="."/>
+  <xsl:choose>
+    <xsl:when test="$object/@id or $object/@xml:id">
+      <a>
+        <xsl:attribute name="href">
+          <xsl:text>#</xsl:text>
+          <xsl:call-template name="object.id">
+            <xsl:with-param name="object" select="$object"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="class">
+          <xsl:text>id_link</xsl:text>
+        </xsl:attribute>
+        <xsl:text> #</xsl:text>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- Only complain about varlistentries if at least one entry in the list has an id -->
+      <xsl:if test="name($object) != 'varlistentry' or $object/parent::variablelist/varlistentry[@id]">
+        <xsl:message terminate="no">
+          <xsl:value-of select ="name($object)"/>
+          <xsl:text> element without id. Please add an id to make it usable</xsl:text>
+          <xsl:text> as stable anchor in the public HTML documentation.</xsl:text>
+        </xsl:message>
+        <xsl:comment>
+          <xsl:text>Please add an id to the </xsl:text>
+          <xsl:value-of select ="name($object)"/>
+          <xsl:text> element in the sgml source code.</xsl:text>
+        </xsl:comment>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index 6410a47958..e4174e0613 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -163,3 +163,13 @@ acronym		{ font-style: inherit; }
     width: 75%;
   }
 }
+
+/* Links to ids of headers and definition terms */
+a.id_link {
+        color: inherit;
+        visibility: hidden;
+}
+
+*:hover > a.id_link {
+        visibility: visible;
+}
#35Brar Piening
brar@gmx.de
In reply to: Karl O. Pinc (#34)
Re: doc: add missing "id" attributes to extension packaging page

On 17.01.2023 at 23:43, Karl O. Pinc wrote:

It's good you asked. After poking about the XSLT 1.0 spec to refresh
my memory I abandoned the "mode" approach entirely. The real "right
way" is to use the import mechanism.

I've attached a patch that "wraps" the section.heading template
and adds extra stuff to the HTML output generated by the stock
template. (example_section_heading_override.patch)

Thanks!

I'll give it a proper look this weekend.

Regards,

Brar

#36Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#34)
Re: doc: add missing "id" attributes to extension packaging page

On Tue, 17 Jan 2023 16:43:13 -0600
"Karl O. Pinc" <kop@karlpinc.com> wrote:

It might be useful to add --nonet to the xsltproc invocation(s)
in the Makefile(s). Just in case; to keep from retrieving
stylesheets from the net. (If the option is not already there.
I didn't look.)

If this is the first time that PG uses the XSLT import mechanism
I imagine that "things could go wrong" depending on what sort
of system is being used to build the docs. I'm not worried,
but it is something to note for the committer.

Looks like doc/src/sgml/stylesheet-fo.xsl already uses
xsl:import, although it is unclear to me whether the import
is applied.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#37Brar Piening
brar@gmx.de
In reply to: Brar Piening (#35)
Re: doc: add missing "id" attributes to extension packaging page

On 18.01.2023 at 06:50, Brar Piening wrote:

I'll give it a proper look this weekend.

It turns out I didn't get a round tuit.

... and I'm afraid I probably will not be able to work on this until
mid/end February so we'll have to move this to the next commitfest until
somebody wants to take it over and push it through.

#38Andres Freund
andres@anarazel.de
In reply to: Brar Piening (#37)
Re: doc: add missing "id" attributes to extension packaging page

Hi,

On 2023-01-26 21:48:54 +0100, Brar Piening wrote:

On 18.01.2023 at 06:50, Brar Piening wrote:

I'll give it a proper look this weekend.

It turns out I didn't get a round tuit.

... and I'm afraid I probably will not be able to work on this until
mid/end February so we'll have to move this to the next commitfest until
somebody wants to take it over and push it through.

A small note: As-is this fails on CI, because we don't allow network access
during the docs build anymore (since it always fails these days):

https://cirrus-ci.com/task/5474029402849280?logs=docs_build#L297

[17:02:03.114] time make -s -j${BUILD_JOBS} -C doc
[17:02:04.092] I/O error : Attempt to load network entity http://cdn.docbook.org/release/xsl/current/html/sections.xsl
[17:02:04.092] warning: failed to load external entity "http://cdn.docbook.org/release/xsl/current/html/sections.xsl&quot;
[17:02:04.092] compilation error: file stylesheet-html-common.xsl line 17 element import
[17:02:04.092] xsl:import : unable to load http://cdn.docbook.org/release/xsl/current/html/sections.xsl

I think this is just due to the common URL in docbook packages being
http://docbook.sourceforge.net/release/xsl/current/*
Because of that the docbook catalog matching logic won't work for that file:

E.g. I have the following in /etc/xml/docbook-xsl.xml, on debian unstable:
<delegateURI uriStartString="http://docbook.sourceforge.net/release/xsl/&quot; catalog="file:///usr/share/xml/docbook/stylesheet/docbook-xsl/catalog.xml"/>

As all our other references use the sourceforge address, this should too.

Greetings,

Andres Freund

#39Karl O. Pinc
kop@karlpinc.com
In reply to: Andres Freund (#38)
Re: doc: add missing "id" attributes to extension packaging page

On Tue, 14 Feb 2023 12:13:18 -0800
Andres Freund <andres@anarazel.de> wrote:

A small note: As-is this fails on CI, because we don't allow network
access during the docs build anymore (since it always fails these
days):

https://cirrus-ci.com/task/5474029402849280?logs=docs_build#L297

[17:02:03.114] time make -s -j${BUILD_JOBS} -C doc
[17:02:04.092] I/O error : Attempt to load network entity
http://cdn.docbook.org/release/xsl/current/html/sections.xsl
[17:02:04.092] warning: failed to load external entity
"http://cdn.docbook.org/release/xsl/current/html/sections.xsl&quot;
[17:02:04.092] compilation error: file stylesheet-html-common.xsl
line 17 element import [17:02:04.092] xsl:import : unable to load
http://cdn.docbook.org/release/xsl/current/html/sections.xsl

This makes me think that it would be useful to add --nonet to the
xsltproc invocations. That would catch this error before it goes to
CI.

I think this is just due to the common URL in docbook packages being
http://docbook.sourceforge.net/release/xsl/current/*
Because of that the docbook catalog matching logic won't work for
that file:

E.g. I have the following in /etc/xml/docbook-xsl.xml, on debian
unstable: <delegateURI
uriStartString="http://docbook.sourceforge.net/release/xsl/&quot;
catalog="file:///usr/share/xml/docbook/stylesheet/docbook-xsl/catalog.xml"/>

As all our other references use the sourceforge address, this should
too.

Agreed.

I'm also noticing that the existing xsl:import-s all import entire
docbook stylesheets. It does not hurt to do this; the output is
unaffected, although I can't say what it means for build performance.
It does keep it simple. Only one import is needed no matter which
templates we use the import mechanism to extend. And by importing
"everything" there's no concern about any (unlikely) changes to
the the "internals" of the catalog.

Should we import only what we need or all of docbook? I don't know.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#40Andres Freund
andres@anarazel.de
In reply to: Karl O. Pinc (#39)
Re: doc: add missing "id" attributes to extension packaging page

Hi,

On 2023-02-15 13:34:37 -0600, Karl O. Pinc wrote:

This makes me think that it would be useful to add --nonet to the
xsltproc invocations. That would catch this error before it goes to
CI.

We are doing that now :)

commit 969509c3f2e3b4c32dcf264f9d642b5ef01319f3
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2023-02-08 17:15:23 -0500

Stop recommending auto-download of DTD files, and indeed disable it.

I'm also noticing that the existing xsl:import-s all import entire
docbook stylesheets. It does not hurt to do this; the output is
unaffected, although I can't say what it means for build performance.
It does keep it simple. Only one import is needed no matter which
templates we use the import mechanism to extend. And by importing
"everything" there's no concern about any (unlikely) changes to
the the "internals" of the catalog.

Should we import only what we need or all of docbook? I don't know.

It couldn't hurt to check if performance improves when you avoid doing so. I
suspect it won't make much of a difference, because the time is actually spent
evaluating xslt rather than parsing it.

Greetings,

Andres Freund

#41Gregory Stark (as CFM)
stark.cfm@gmail.com
In reply to: Brar Piening (#37)
Re: doc: add missing "id" attributes to extension packaging page

On Thu, 26 Jan 2023 at 15:55, Brar Piening <brar@gmx.de> wrote:

On 18.01.2023 at 06:50, Brar Piening wrote:

I'll give it a proper look this weekend.

It turns out I didn't get a round tuit.

... and I'm afraid I probably will not be able to work on this until
mid/end February so we'll have to move this to the next commitfest until
somebody wants to take it over and push it through.

Looks like a lot of good work was happening on this patch right up
until mid-February. Is there a lot of work left? Do you think you'll
have a chance to wrap it up this commitfest for this release?

--
Gregory Stark
As Commitfest Manager

#42Brar Piening
brar@gmx.de
In reply to: Gregory Stark (as CFM) (#41)
Re: doc: add missing "id" attributes to extension packaging page

On 20.03.2023 at 19:47, Gregory Stark (as CFM) wrote:

Looks like a lot of good work was happening on this patch right up
until mid-February. Is there a lot of work left? Do you think you'll
have a chance to wrap it up this commitfest for this release?

Thanks for the ping.

I had another look this morning and I think I can probably finish this
by the end of the week.

#43Brar Piening
brar@gmx.de
In reply to: Karl O. Pinc (#34)
1 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On 17.01.2023 at 23:43, Karl O. Pinc wrote:

It's good you asked. After poking about the XSLT 1.0 spec to refresh
my memory I abandoned the "mode" approach entirely. The real "right
way" is to use the import mechanism.

It actually is not.

After quite some time trying to figure out why things don't work as
intended, I ended up reading the XSLT 1.0 spec.

As the name already suggests, <xsl:apply-imports> is closely related to
<xsl:apply-templates> with the difference that it *applies* a *template
rule* from an imported style sheet instead of applying a template rule
from the current style sheet
(https://www.w3.org/TR/1999/REC-xslt-19991116#apply-imports). What it
does not do is *calling* a *named template*
(https://www.w3.org/TR/1999/REC-xslt-19991116#named-templates).

What this basically means is that in XSLT 1.0 you can use
<xsl:apply-imports> to override template rules (<xsl:template
match="this-pattern-inside-match-makes-it-a-template-rule">) but you
cannot use it to override named templates (<xsl:template
name="this-id-inside-name-makes-it-a-named-template">). If you want to
override named templates you basically have to duplicate and change them.

While there are mechanisms to call overriden named templates in XSLT 3,
this is out of scope here, since we're bound to XSLT 1.0

As a consequence, there was little I could change in the initial patch
to avoid the code duplication and all attempts to do so, ultimately led
to even longer and more complex code without really reducing the amount
of duplication.

The <xsl:apply-imports> approach actually does work in the varlistentry
case, although this doesn't really change a lot regarding the length of
the patch (it's a bit nicer though since in this case it really avoids
duplication). I've also taken the advice to terminate the build and
print the xpath if a required id is missing.

The attached patch is my best-effort approach to implement discoverable
links.

Best regards,

Brar

Attachments:

make_html_ids_discoverable_v3.patchtext/plain; charset=UTF-8; name=make_html_ids_discoverable_v3.patchDownload
diff --git a/doc/src/sgml/pgwalinspect.sgml b/doc/src/sgml/pgwalinspect.sgml
index 62d9f9eb22..9a0241a8d6 100644
--- a/doc/src/sgml/pgwalinspect.sgml
+++ b/doc/src/sgml/pgwalinspect.sgml
@@ -157,7 +157,7 @@ combined_size_percentage     | 2.8634072910530795
     </listitem>
    </varlistentry>
 
-   <varlistentry id="pgwalinspect-funcs-pg-get-wal-block-info">
+   <varlistentry>
     <term>
      <function>pg_get_wal_block_info(start_lsn pg_lsn, end_lsn pg_lsn) returns setof record</function>
     </term>
diff --git a/doc/src/sgml/stylesheet-html-common.xsl b/doc/src/sgml/stylesheet-html-common.xsl
index 3f85ea9536..9df2782ce4 100644
--- a/doc/src/sgml/stylesheet-html-common.xsl
+++ b/doc/src/sgml/stylesheet-html-common.xsl
@@ -301,120 +301,4 @@ set       toc,title
   </xsl:choose>
 </xsl:template>
 
-<!-- Override the standard section heading generation to add an id link -->
-<xsl:template name="section.heading">
-  <xsl:param name="section" select="."/>
-  <xsl:param name="level" select="1"/>
-  <xsl:param name="allow-anchors" select="1"/>
-  <xsl:param name="title"/>
-  <xsl:param name="class" select="'title'"/>
-
-  <xsl:variable name="id">
-    <xsl:choose>
-      <!-- Make sure the subtitle doesn't get the same id as the title -->
-      <xsl:when test="self::subtitle">
-        <xsl:call-template name="object.id">
-          <xsl:with-param name="object" select="."/>
-        </xsl:call-template>
-      </xsl:when>
-      <!-- if title is in an *info wrapper, get the grandparent -->
-      <xsl:when test="contains(local-name(..), 'info')">
-        <xsl:call-template name="object.id">
-          <xsl:with-param name="object" select="../.."/>
-        </xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:call-template name="object.id">
-          <xsl:with-param name="object" select=".."/>
-        </xsl:call-template>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <!-- HTML H level is one higher than section level -->
-  <xsl:variable name="hlevel">
-    <xsl:choose>
-      <!-- highest valid HTML H level is H6; so anything nested deeper
-           than 5 levels down just becomes H6 -->
-      <xsl:when test="$level &gt; 5">6</xsl:when>
-      <xsl:otherwise>
-        <xsl:value-of select="$level + 1"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-  <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
-    <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
-    <xsl:if test="$css.decoration != '0'">
-      <xsl:if test="$hlevel&lt;3">
-        <xsl:attribute name="style">clear: both</xsl:attribute>
-      </xsl:if>
-    </xsl:if>
-    <xsl:if test="$allow-anchors != 0">
-      <xsl:call-template name="anchor">
-        <xsl:with-param name="node" select="$section"/>
-        <xsl:with-param name="conditional" select="0"/>
-      </xsl:call-template>
-    </xsl:if>
-    <xsl:copy-of select="$title"/>
-    <xsl:call-template name="pg.id.link">
-      <xsl:with-param name="object" select="$section"/>
-    </xsl:call-template>
-  </xsl:element>
-</xsl:template>
-
-<!-- Override the standard varlistentry/term generation to add an id link
-     after the last term -->
-<xsl:template match="varlistentry/term">
-  <xsl:apply-imports/>
-  <xsl:if test="position() = last()">
-    <xsl:call-template name="pg.id.link">
-      <xsl:with-param name="object" select="parent::varlistentry"/>
-    </xsl:call-template>
-  </xsl:if>
-</xsl:template>
-
-<!-- Creates a link pointing to an id within the document -->
-<xsl:template name="pg.id.link">
-  <xsl:param name="object" select="."/>
-  <xsl:choose>
-    <xsl:when test="$object/@id or $object/@xml:id">
-      <a>
-        <xsl:attribute name="href">
-          <xsl:text>#</xsl:text>
-          <xsl:call-template name="object.id">
-            <xsl:with-param name="object" select="$object"/>
-          </xsl:call-template>
-        </xsl:attribute>
-        <xsl:attribute name="class">
-          <xsl:text>id_link</xsl:text>
-        </xsl:attribute>
-        <xsl:text> #</xsl:text>
-      </a>
-    </xsl:when>
-    <xsl:otherwise>
-      <!-- Only complain about varlistentries if at least one entry in the list has an id -->
-      <xsl:if test="name($object) != 'varlistentry' or $object/parent::variablelist/varlistentry[@id]">
-        <xsl:message terminate="yes">
-          <xsl:text>A </xsl:text>
-          <xsl:value-of select ="name($object)"/>
-          <xsl:text> element at path '</xsl:text>
-          <xsl:for-each select="$object/ancestor::*">
-            <xsl:text>/</xsl:text>
-            <xsl:value-of select ="name(.)"/>
-            <xsl:if test="@id|@xml:id">
-              <xsl:text>[@</xsl:text>
-              <xsl:value-of select ="name(@id|@xml:id)"/>
-              <xsl:text> = '</xsl:text>
-              <xsl:value-of select ="@id"/>
-              <xsl:text>']</xsl:text>
-            </xsl:if>
-          </xsl:for-each>
-          <xsl:text>' is missing an id. Please add one to make it usable</xsl:text>
-          <xsl:text> as stable anchor in the public HTML documentation.</xsl:text>
-        </xsl:message>
-      </xsl:if>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
 </xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index 15bcc95d41..cc14efa1ca 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -169,13 +169,3 @@ acronym		{ font-style: inherit; }
     width: 75%;
   }
 }
-
-/* Links to ids of headers and definition terms */
-a.id_link {
-        color: inherit;
-        visibility: hidden;
-}
-
-*:hover > a.id_link {
-        visibility: visible;
-}
#44Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#43)
2 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On Tue, 21 Mar 2023 23:16:25 +0100
Brar Piening <brar@gmx.de> wrote:

On 17.01.2023 at 23:43, Karl O. Pinc wrote:

It's good you asked. After poking about the XSLT 1.0 spec to
refresh my memory I abandoned the "mode" approach entirely. The
real "right way" is to use the import mechanism.

After quite some time trying to figure out why things don't work as
intended, I ended up reading the XSLT 1.0 spec.

As the name already suggests, <xsl:apply-imports> is closely related
to <xsl:apply-templates> with the difference that it *applies* a
*template rule* from an imported style sheet instead of applying a
template rule from the current style sheet
(https://www.w3.org/TR/1999/REC-xslt-19991116#apply-imports). What it
does not do is *calling* a *named template*
(https://www.w3.org/TR/1999/REC-xslt-19991116#named-templates).

What this basically means is that in XSLT 1.0 you can use
<xsl:apply-imports> to override template rules (<xsl:template
match="this-pattern-inside-match-makes-it-a-template-rule">) but you
cannot use it to override named templates (<xsl:template
name="this-id-inside-name-makes-it-a-named-template">). If you want to
override named templates you basically have to duplicate and change
them.

While there are mechanisms to call overriden named templates in XSLT
3, this is out of scope here, since we're bound to XSLT 1.0

(It was reassuring to see you take the steps above; I once did exactly
the same with and had the same excitements and disappointments. I
feel validated. ;-)

(One of my disappointments is that xsltproc supports only XSLT 1.0,
and nothing later. IIRC, apparently one big reason is not the amount
work needed to develop the program but the work required to develop a
test suite to validate conformance.)

As a consequence, there was little I could change in the initial patch
to avoid the code duplication and all attempts to do so, ultimately
led to even longer and more complex code without really reducing the
amount of duplication.

You're quite right. I clearly didn't have my XSLT turned on. Importing
only works when templates are matched, not called by name.

Sorry for the extra work I've put you through.

The <xsl:apply-imports> approach actually does work in the
varlistentry case, although this doesn't really change a lot
regarding the length of the patch (it's a bit nicer though since in
this case it really avoids duplication).

You've put in a lot of good work. I'm attaching 2 patches
with only minor changes.

001-add-needed-ids_v1.patch

This separates out the addition of ids from the XSLT changes, just
to keep things tidy. Content is from your patch.

002-make_html_ids_discoverable_v4.patch

I changed the linked text, the #, so that the leading space
is not linked. This is arguable, as the extra space makes
it easier to put the mouse on the region. But it seems
tidy.

I've tided up so the lines are no longer than 80 chars.

I've also taken the advice
to terminate the build and print the xpath if a required id is
missing.

This looks awesome. I love the xpath! I've changed the format of the
error message. What do you think? (Try it out by _not_ applying
001-add-needed-ids_v1.patch.)

Also, the error message now has leading and trailing newlines to make
it stand out. I'm normally against this sort of thing but thought I'd
add it anyway for others to review.

I'm ready to send these on to a committer but if you don't
like what I did please send more patches for me to review.

Outstanding questions (for committer?):

The 002-make_html_ids_discoverable_v4.patch generates xhtml <h1>,
<h2>, etc. attributes using a XSLT <element> element with a
"namespace" attribute. I'm unclear on the relationship PG has with
xhtml and namespaces. Looks right to me, since the generated html has
the same namespace name appearing in the xmlns attribute of the html
tag, but somebody who knows more than me might want to review this.

Using the namespace attribute does not seem to have affected the
generated html, as far as my random sampling of output can tell.

What character should be used to represent a link anchor?

I've left your choice of "#" in the patch.

If we go to unicode, My preference is the text paperclip 📎︎

Here's a table of all the choices I came up with, there may be others
that are suitable. (The hex representations are Python 3 string
literals. So print("\U0001f4ce\ufe0e") prints the text paperclip.)

Hash mark # (ASCII, used in the patch, \u0023)
Anchor ⚓ \u2693
Place of interest ⌘ \u2318
Bullseye ◎ \u25ce
Link (emoji variant) 🔗 \U0001f517
Link (text variant) 🔗︎ \U0001f517\ufe0e
Paperclip (emoji variant) 📎 \U0001f4ce
Paperclip (text variant) 📎︎ \U0001f4ce\ufe0e

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

001-add-needed-ids_v1.patchtext/x-patchDownload
diff --git a/doc/src/sgml/pgwalinspect.sgml b/doc/src/sgml/pgwalinspect.sgml
index 9a0241a8d6..62d9f9eb22 100644
--- a/doc/src/sgml/pgwalinspect.sgml
+++ b/doc/src/sgml/pgwalinspect.sgml
@@ -157,7 +157,7 @@ combined_size_percentage     | 2.8634072910530795
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="pgwalinspect-funcs-pg-get-wal-block-info">
     <term>
      <function>pg_get_wal_block_info(start_lsn pg_lsn, end_lsn pg_lsn) returns setof record</function>
     </term>
002-make_html_ids_discoverable_v4.patchtext/x-patchDownload
diff --git a/doc/src/sgml/stylesheet-html-common.xsl b/doc/src/sgml/stylesheet-html-common.xsl
index 9df2782ce4..65c58ba750 100644
--- a/doc/src/sgml/stylesheet-html-common.xsl
+++ b/doc/src/sgml/stylesheet-html-common.xsl
@@ -301,4 +301,126 @@ set       toc,title
   </xsl:choose>
 </xsl:template>
 
+
+<!-- Override the standard section heading generation to add an id link -->
+<xsl:template name="section.heading">
+  <xsl:param name="section" select="."/>
+  <xsl:param name="level" select="1"/>
+  <xsl:param name="allow-anchors" select="1"/>
+  <xsl:param name="title"/>
+  <xsl:param name="class" select="'title'"/>
+   <xsl:variable name="id">
+    <xsl:choose>
+      <!-- Make sure the subtitle doesn't get the same id as the title -->
+      <xsl:when test="self::subtitle">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="."/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- if title is in an *info wrapper, get the grandparent -->
+      <xsl:when test="contains(local-name(..), 'info')">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="../.."/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select=".."/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+   <!-- HTML H level is one higher than section level -->
+  <xsl:variable name="hlevel">
+    <xsl:choose>
+      <!-- highest valid HTML H level is H6; so anything nested deeper
+           than 5 levels down just becomes H6 -->
+      <xsl:when test="$level &gt; 5">6</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$level + 1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
+    <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
+    <xsl:if test="$css.decoration != '0'">
+      <xsl:if test="$hlevel&lt;3">
+        <xsl:attribute name="style">clear: both</xsl:attribute>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="$allow-anchors != 0">
+      <xsl:call-template name="anchor">
+        <xsl:with-param name="node" select="$section"/>
+        <xsl:with-param name="conditional" select="0"/>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:copy-of select="$title"/>
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="$section"/>
+    </xsl:call-template>
+  </xsl:element>
+</xsl:template>
+
+
+<!-- Override the standard varlistentry/term generation to add an id link
+     after the last term -->
+<xsl:template match="varlistentry/term">
+  <xsl:apply-imports/>
+  <xsl:if test="position() = last()">
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="parent::varlistentry"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+
+<!-- Creates a link pointing to an id within the document -->
+<xsl:template name="pg.id.link">
+  <xsl:param name="object" select="."/>
+  <xsl:choose>
+    <xsl:when test="$object/@id or $object/@xml:id">
+      <xsl:text> </xsl:text>
+      <a>
+        <xsl:attribute name="href">
+          <xsl:text>#</xsl:text>
+          <xsl:call-template name="object.id">
+            <xsl:with-param name="object" select="$object"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="class">
+          <xsl:text>id_link</xsl:text>
+        </xsl:attribute>
+        <xsl:text>#</xsl:text>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- Only complain about varlistentries if at least one entry in
+           the list has an id -->
+      <xsl:if test="name($object) != 'varlistentry'
+                    or $object/parent::variablelist/varlistentry[@id]">
+        <xsl:message terminate="yes">
+          <xsl:text>&#10;</xsl:text>  <!-- leading newline -->
+          <xsl:text>Ids are required in order to provide the public</xsl:text>
+          <xsl:text> HTML documentation with stable URLs for &lt;</xsl:text>
+          <xsl:value-of select ="name($object)"/>
+          <xsl:text>&gt; element content; id missing at: </xsl:text>
+          <xsl:for-each select="$object/ancestor::*">
+            <xsl:text>/</xsl:text>
+            <xsl:value-of select ="name(.)"/>
+            <xsl:if test="@id|@xml:id">
+              <xsl:text>[@</xsl:text>
+              <xsl:value-of select ="name(@id|@xml:id)"/>
+              <xsl:text> = '</xsl:text>
+              <xsl:value-of select ="@id"/>
+              <xsl:text>']</xsl:text>
+            </xsl:if>
+          </xsl:for-each>
+          <xsl:text>&#10; </xsl:text>  <!-- trailing newline -->
+        </xsl:message>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index cc14efa1ca..15bcc95d41 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -169,3 +169,13 @@ acronym		{ font-style: inherit; }
     width: 75%;
   }
 }
+
+/* Links to ids of headers and definition terms */
+a.id_link {
+        color: inherit;
+        visibility: hidden;
+}
+
+*:hover > a.id_link {
+        visibility: visible;
+}
#45Brar Piening
brar@gmx.de
In reply to: Karl O. Pinc (#44)
Re: doc: add missing "id" attributes to extension packaging page

On 23.03.2023 at 04:09, Karl O. Pinc wrote:

You're quite right. I clearly didn't have my XSLT turned on. Importing
only works when templates are matched, not called by name.

Sorry for the extra work I've put you through.

No problem. As always I've learnt something which may help me in the future.

You've put in a lot of good work. I'm attaching 2 patches
with only minor changes.

Thanks. When comparing things I also realized that I had accidentally
created a reversed patch. Thanks for fixing this.

001-add-needed-ids_v1.patch

This separates out the addition of ids from the XSLT changes, just
to keep things tidy. Content is from your patch.

+1

002-make_html_ids_discoverable_v4.patch

I changed the linked text, the #, so that the leading space
is not linked. This is arguable, as the extra space makes
it easier to put the mouse on the region. But it seems
tidy.

I tend to prefer a slightly bigger mouseover-region but I don't really mind.

I've tided up so the lines are no longer than 80 chars.

+1

This looks awesome. I love the xpath! I've changed the format of the
error message. What do you think? (Try it out by _not_ applying
001-add-needed-ids_v1.patch.)

Also, the error message now has leading and trailing newlines to make
it stand out. I'm normally against this sort of thing but thought I'd
add it anyway for others to review.

+1

I'm ready to send these on to a committer but if you don't
like what I did please send more patches for me to review.

I like it and think it's ready for commiter.

Outstanding questions (for committer?):

The 002-make_html_ids_discoverable_v4.patch generates xhtml <h1>,
<h2>, etc. attributes using a XSLT <element> element with a
"namespace" attribute.

I'm not sure I follow. I cannot see any namespacing weirdness in my output.

Are you using the v1.79.2 styleshhets?

What character should be used to represent a link anchor?

It's not the first time this is coming up. See my response in the old
thread:
/messages/by-id/e50193ea-ca5c-e178-026a-f3fd8942252d@gmx.de

Personally I'd advise to stick with ASCII for now.

In any case changing the symbol at some point would be a very minor
effort if we deem it necessary.

Maybe this could be part of some general overhaul of the visual
apperance and website styling by a person with more talent for this than
I have.

Regards,

Brar

#46Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Karl O. Pinc (#44)
Re: doc: add missing "id" attributes to extension packaging page

Thanks, Brar and Karl, I hope we can get this done soon.

As with the <simplelist> patch, we'll need to patch the CSS used in the
website for the docs too, as that's the most important place where docs
are visited. See this commit for an example:
https://git.postgresql.org/gitweb/?p=pgweb.git;a=commitdiff;h=0b89ea0fff28d29ed177c82a274144453e3c7f82

In order to test locally that your patched stylesheet works correctly,
you'd have to compile the docs with "make html STYLE=website" in the doc
subdir, and tweak one of the CSS files there (I think it's
docs-complete.css) so that it references your local copy instead of
fetching it from the website.

diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index cc14efa1ca..15bcc95d41 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -169,3 +169,13 @@ acronym		{ font-style: inherit; }
width: 75%;
}
}
+
+/* Links to ids of headers and definition terms */
+a.id_link {
+        color: inherit;
+        visibility: hidden;
+}
+
+*:hover > a.id_link {
+        visibility: visible;
+}

I'm not clear on what exactly becomes visible when one hovers over what.
Can you please share a screenshot?

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

#47Brar Piening
brar@gmx.de
In reply to: Alvaro Herrera (#46)
Re: doc: add missing "id" attributes to extension packaging page

On 23.03.2023 at 10:35, Alvaro Herrera wrote:

As with the <simplelist> patch, we'll need to patch the CSS used in the
website for the docs too, as that's the most important place where docs
are visited. See this commit for an example:
https://git.postgresql.org/gitweb/?p=pgweb.git;a=commitdiff;h=0b89ea0fff28d29ed177c82a274144453e3c7f82

In order to test locally that your patched stylesheet works correctly,
you'd have to compile the docs with "make html STYLE=website" in the doc
subdir, and tweak one of the CSS files there (I think it's
docs-complete.css) so that it references your local copy instead of
fetching it from the website.

Thanks I'll take care of this tonight.

I'm not clear on what exactly becomes visible when one hovers over what.
Can you please share a screenshot?

I could, but since hover effects don't really come across in screenshots
I've posted a build of the docs including the patch to
https://pgdocs.piening.info

See https://pgdocs.piening.info/app-psql.html as an example.

#48Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#45)
Re: doc: add missing "id" attributes to extension packaging page

On Thu, 23 Mar 2023 08:24:48 +0100
Brar Piening <brar@gmx.de> wrote:

On 23.03.2023 at 04:09, Karl O. Pinc wrote:

Sorry for the extra work I've put you through.

No problem. As always I've learnt something which may help me in the
future.

I don't know about you, but sadly, my brain eventually leaks. ;-)

I'm attaching 2 patches
with only minor changes.

001-add-needed-ids_v1.patch

This separates out the addition of ids from the XSLT changes, just
to keep things tidy.

002-make_html_ids_discoverable_v4.patch

I changed the linked text, the #, so that the leading space
is not linked. This is arguable, as the extra space makes
it easier to put the mouse on the region.

I tend to prefer a slightly bigger mouseover-region but I don't
really mind.

I'm leaving it for the committer to review.

I've changed the format of

the error message. What do you think? (Try it out by _not_
applying 001-add-needed-ids_v1.patch.)

Also, the error message now has leading and trailing newlines to
make it stand out.

Including the error message/make output here, so everyone can see
easily.

--------------<snip>------------
/usr/bin/xsltproc --nonet --path . --stringparam pg.version '16devel' stylesheet.xsl postgres-full.xml

Ids are required in order to provide the public HTML documentation with stable URLs for <varlistentry> element content; id missing at: /book[@id = 'postgres']/part[@id = 'appendixes']/appendix[@id = 'contrib']/sect1[@id = 'pgwalinspect']/sect2[@id = 'pgwalinspect-funcs']/variablelist

no result for postgres-full.xml
make: *** [Makefile:146: html-stamp] Error 10
--------------<snip>------------

I like it and think it's ready for commiter.

I've marked it ready for the committer in the commitfest.

Outstanding questions (for committer?):

The 002-make_html_ids_discoverable_v4.patch generates xhtml <h1>,
<h2>, etc. attributes using a XSLT <element> element with a
"namespace" attribute.

I'm not sure I follow. I cannot see any namespacing weirdness in my
output.

There's nothing weird in the output, it's all about how
you're generating it in the xslt with

<xsl:element name="h$level" namespace="...

Output looks right to me.

Are you using the v1.79.2 styleshhets?

Yes. But I've got both the ones with namespaces and without
installed.

I've just never had to look at what PG is doing with namespaces
before. What you've done looks right to me, but I'm pretty
clueless so somebody else should double check.]

What character should be used to represent a link anchor?

Personally I'd advise to stick with ASCII for now.

+1

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#49Karl O. Pinc
kop@karlpinc.com
In reply to: Alvaro Herrera (#46)
2 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On Thu, 23 Mar 2023 10:35:55 +0100
Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

As with the <simplelist> patch, we'll need to patch the CSS used in
the website for the docs too, as that's the most important place
where docs are visited. See this commit for an example:
https://git.postgresql.org/gitweb/?p=pgweb.git;a=commitdiff;h=0b89ea0fff28d29ed177c82a274144453e3c7f82

In order to test locally that your patched stylesheet works correctly,
you'd have to compile the docs with "make html STYLE=website" in the
doc subdir, and tweak one of the CSS files there (I think it's
docs-complete.css) so that it references your local copy instead of
fetching it from the website.

I should have known to put the css in a separate patch.

I'm not clear on what exactly becomes visible when one hovers over
what. Can you please share a screenshot?

Attached are 2 screenshots. I don't know why, but for
some reason you can't see the mouse pointer.

"#' shows up when the mouse is anywhere over the html heading element.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachments:

with_mouseover.pngimage/pngDownload
�PNG


IHDR�HG
sBIT��O� IDATx^�������9��Qr� " �P1$��H�I$gI"Q�H���H�9�����qfwv�v��P�x�lwuu��=3�T������GA@A@A #���(W)# MA@A@����-V�@/��  ��  ��'�Q ��  �� �p�Nh~�����_A@A f ���'������ H+A@A@b.G��7����]�s�����  ��  �H�����y��A-��  �� s0r��B�c�`����  �� C�}'bh�K�A@A@4��`A@A@��'��#@�/��  �� `�'�5v2&b���o������'~~O����Kc�q��I�� ~���c�wF��=�V�&N,k��@����A����/_��7o����&K/^<��-�@8 ����oG�8�-K��)��C%�R�����%��c!�������k�x5��[�U`�����'{�l�����M�<YTm��-�@�C@^�E�>����w�=�(Q�X�W%5�G�d��������E�  1��X��c�H�A��t��x�cP�G��B��u}�dIc������6	�� ���8����sn���;w���1@��<yr3�=T"�A@&?�������d��4��R��H�$����}����ZZ(Djx����(�C�����i�JbtB���'I�
'�N]C��,YR???�i����f��[����e�f;M�Vb��>|��|_wj�<�c������n��?�
s�;���=Q.����Gs�PA�c�T�6�,�������s��y��}
��F���
�8G��a���'�|��'�>�Z�*m��y��I�O�D�f���  ����p���-�0��[6jF��T5�<|�N#�
j�E�s.B�}}}����1C�C��<fN6=/J��a~��}7�l���W=��O���>����8�������QMRX�(�=|8s��s�/���d����~���)$#��@�A@��\�t>�-��<v�����-�����9<^l�ga��>��	8}X����S5�sp��w3���$rp5v��T����HR��^~�����@�n��l��,�V���^�NYW��-1�����F6m���>�
G1��j���y[����8��i`��IR�H3�'�d�T��>����u�=��+J<��\��Vm�����}R�z�V�m���{�.a��,�/#�������mp�����j���/������u�~x�O�c�oB��q�$���$;�'���3������	���ti��+U���'K��]97��{��S�F������nX�v���,�
X�����7l�0{��0��?����2}�A�-CG�)V�`��U~;*a���'>%�$�W�x����AAY2fL�$��U��x�
B���Q���589q�����4��3�8�^���
��t��g�&�J������0y��]�._����+U(��E������[7*"s?i���[
��]+*���"�9v����q;b"#�@dC���{�s��eC|�����5e�a3����;����P	G���E���OG��U������7V���6rL�����(m�������e����T��0�$N�����R�{������"U��9�^�1��]5�y�(.�u��E���7a���|��f�S�0�'v��=�t�����H�(a�R%��R��x��=|�(q�D�&�l��`���?o����4��?�O��uA���L,Y�
�zw��>}:J-Y�j��Z����/]��D�bn�(�~�a�V-U�X��U��m��9s��q���!#F����k�F�X�@�a�&���������C�<tx���6��j��+J,�K�  Do����Z����4�+������M>2(�����!3��n��W�����9�_��f��a��+U���	vDO8N4J�`�!$��o�])�����U���3g����o+�/��.V���Sg�=x�^��%���p��������������H��v���o���8Q����}�q#���9?^�xi��E�����#{������Z�n����F��/L�u��G}���k�5�Uy�ZeU��_�>z�8N��U+�����hi�?�]������/fL���GM_����l�������d��X��{���������9v���g���N?>��
��'N��c����G�x������bQ����������o�"�>i������|��#���f2�����o��$Q"�53l��2���Z�+��C�7m�Q��kNkC"1����X��.��a�AF"������c�����1K���E%�N���7�/�i�YF�����K���q�&]����[5o��$t�z�*��?���5K�^=�?>���>�U��.�+%�?����m;v��?c�t���R�����y�V��_��H�L���c�"EHd��I��o����'����[��R�����o`��g����us�sG�������%��/o���z��{��q��<����l����J���t�~���h1�����k5��n���_�Vj��-{��S����e�~������?{�����~����O�<i���-^�T�P~AH�+Z!^�fm���e
��
�@�D`����S���`�I'������l<5��9r�=s�\�|���<(a����<q�d���&'&b8$|"�p�V%��I!n��c����n����W���Y�Jc���w��?�O��)��0l�����o��J�$���K�.�����G�����|�����S�J[�d�u�d���V�;vb��)N�kUW�����X��3{Va]�!��v���������x��S��n����N9�e]�a��oFN=�
���j���{��u��Iq�~7~�������F���3G��?�����V�}'N�gA��������	I�$����g���0���Szv�����am��\�/I��~O��&M���������czD���j��^���={���2��F�)����u'��S�-����.;b�~?���d0��/������I�����r��������u��Q]��,Q����S�����u�WJ��X�<�����d�����.����%�V��;O�\����;p����H�7xh����'�g\A����{��It�+%a"��[�����������n�>�S�6��~T;��o�������8����#�
���tM�a���i��g�����s3���,S���5k�\��)cF	4��.�
}9����q������#��O�$u���}�����fN^�U�D���S���]6��b1Og/:n�P�����H������{%��������
�Uw��i`�����GCb|?i|�x���^'�`��������}",�8��e�����O�"��@2����V9e���S�k��icF&O���M��z��|��f����}2g�X�F�����n��=�����,�k'N��L���l����n�������_�=��;.�3g��L������r�0�j��!����Q}��
�w�{�z�Y�E3��}7���>5�WI�$)�.^�k�����CP�t����Kj�Z�a�:�7�j�V�/�(G��5u���	�7y�}��w��wLKt�a������8q�9�p����yw���!?����� ixO,�Xf�*���-8��u;�k���W������:����'w�n���Y?��H%��[mFa�r��Uk�^���G�W��q*+=���P��Z�����s�.��h��a�����!�N�Z����1e"<�eJ�����p��7nl����y?(wo�l���:�Y���/q�6s���wY��y����J�����>]�t^[�R�{�)3f4�_����ec�+W�8th����_�k�����p!�8Mg��5����r�����S'I�X5V�5���K��[�P��)N������C����[^)7d��7b��S�6����		��y�3�X�4�9I	���9p�9��a��5��
�4��D�8AZ��@�C�o��A�GOr���*8�D(�Y��"v��9��^��z1�w�P��a�y��S�fcM������*�?���S������D����J���H�������;�S;���#UJ����d��g�pM�7��B����C�������d�V,c<|���WZ�J��&��1[C?~��\��:U�y�>m�/�}���
����5��
������:O������i���s�������Gg��:q��s�^R��r���w���l���^��&ii����o����+��;ueH�p���2�C��&;}��/��o�N1�����"��x�-������G�>�X	���y��4���������wF3`Be���S���6H�2�|>g�O��?|�VS��6��#%���8;,^�����F�d{Eg���� ���/_�J����,���4�_��H�0~��	5�$��� v��5"U�1�������q���������/B;HdM$��>r�d�/�yE�����������
Es����]��].���3��s�wsd����^�~�k�i���B[��	���H���|��B9uu��K����J��i��:�j�J�	R�lYH$�����H��'�Wi���b0�=s[$D���>����u�k�H	������!��q5�b7�����h�3'���!�}�f��p�����A2�;9�f��>]�M���'�����X*=]��/v��|�o���_��hc�W�Y�����C��qU�Pi�������������40�L��#�����7k�Xs����5������[�s�4�`���6~���G������X�f�`My���������7�"Q	X���'L�/G�iy���HTq�~��3i���
��������t<|Z��e��U���I��l��
�;<�P|�N��A9�(m���i��g�^�j5�Y�8��q�����{
<�|�� �`�O�6n��7de���8W<�
�-������U��&Yt��u�����F�6��m���ue=�,�0C����
O51 �?��t�Ne���O�e��=��]�4Q�W���S�A�K��r���3�����K����
b�����j���b�����(�K���/0���|�
C�,
�%8�mIA :!�!d	�
�!���rDf�o�� ��;h�f�������)�"�(sX��R9�������W��^�zu���[��M�T���S�0~��[���������h|����y�����=�u�V�:��D[7�F3�����^���������������4YR��2V,������������	,�y�N��%�2��b4F�F��R�
����mZ@�z
��D�]l�K��K�����g���������3�.`��"ErC���{Yo��,?�}���Xg�R)�f�U��5v����I�+y-]a��o����2����Y�>8�9��0��M��y���������V�����!|8al*]/�)��{����'����+V���.�U�y��#o�Ll4����p����fi��M[`�Jb����W��9s���ol\iUz�T��{VE������������m��I�
�w�J�WDc��������4���S��x�/Zd���'O�~)_>��w�wA��Cz�9���N�>j�8CL��`��$���!����P��e$W���z6�x�$l�T�"`��z�O���������}��8��x�?uV�����77y�!��`g���-^��G�AO�J�lIhX!s����/\������~���K���.�>m�7�[,Hg��%K9�bI_��u&L��f��<9s����iqs-�g���U��f��;�9�iP��EKqYA���I��c�����=<m��;�!]���;|���i���)<�[7�x��{��[g���~��������>�b�
}�A�D�����g�Au�Q���$zk�_���k [O(���c;�!��q����_~�}=b�����z���7���%���)����8�����sMF���6-��8au���T�����lg��>=�O�:�y�v="���W],|����������
��'K�#��Z,�0��u�r��	��w7r��������x��KV�|9�1#���{����4���X�T��m^��*]�"�i��i3.\��u�)}�!�����uJ�*Yb��iY�fN�wP/���|���s���K�����pqW���}�>�X�(��\!&��@TA@�ahT�9�������^|t���m�S:62���Y���cX���>�y��+U��G���Y���r���f�����g��'b1'��w���$S��u�~-���t����;���a+.�A@����{[���~b��^>T�og������~^�X�	!�w!��V�L@���?8V1?g�,B&�7lPO���H��GwT��B����H�� ����9��
�!�s�9"C��>>o�� �`/�����a�!��K �
�2���u��]b� ��;��  �9qx�
Bv`�JeM�{;<�KG
���������Q.X  7Up$K�9����%�9�%�A@A@")&N�>�I�E�
7�:��7�D� :���]����BWR�A@���qb�G����$K��/�D��J��7l@����m��	�� 1'������@@@`��?�Yl;��"�"e
>���RNA���h�Y\�y;W.'^�Y(Hk��r�bHG��H;A@�/0�����7��pF���kE��Ck�\��"��*x���,�2DP�R�  �#'�#]���������+��f��!�P��>�Y�3f�t���,�^|x<�5P�#�@� `��S��"D�2�
$.y���Xq��.�D4Y�f�'���G��I?^��	���#�����O�:�����OG�&������ I��)R�x�Xq	������1C���N�>}�����o=
���h���4A@�Y3���1r��5_�F-�CA B �8o��Z�T&�@TF�������Q�3�vA@A@o  ��(�A@A@����p���{b�  ��  ��70�{C���/�;N���}c�bI��*�/{B�A@B��su?sA�,-�! ��#�"U�����S�2I�A@���g�����b����O�ION�	z��,WN���d����b�  �� �
pu��'00P|������'vP���q|!�����BA@A �������x�=p��m����%y�"�  ��  D[�~�����q�����<}��Yp0�;V�8qb�m��q���)�w���H�AV�1kBl��	��  �����a	~���/0��s�y0�g���OY��(a�D	�Eff,��ph�2��{f��DEHA@�><�c����!�{���'B���,C8����#�8B�������J��������D�����z�RA@A R!�8��o�cQd:����>z��)��@�HK��;����6�������%l�~�@��U*�������d���'N�F�<��/����&M�O�l��_��`})��^�N��������������'��o:p������.[�,%��Y�Z�D�<�]�
��  1
���?�H��4i�8qbo5�����Q��M�l�FEh#(�U�nS��-mJ"�<��a�*���L�8Qx�O�1����$f4<M�w���-����SE�_�����}��Y�����E?�H���zR���7wn���f�����6��n���s���V�J�:�����'�$��02��' IDAT�e���s��W���aVh� 7�������N]�2��Wv6h��m���r%�-�[����i����5��9HZ�����L�����B����9
�����y��Y��~��qCl������e��Q�����fK)BAsz�R�m}������w��!��M=��JOr�C�-����;p�7�T�V��o7��7��O�Z�h1>]������F�8�;|-&+l��X�b�u�z����5K��m[�I�Zk��[�!�d%N���u��~?k�o��2��~Y���'� 7����0a�Q�FY���j�w�W�^=U�Ta��n��y�������j����:���5��ZK����;HS�E���~K�T��Ah�:�����G��f9r�[�E���7��I���m��U��!T�S�}��.��:?'�v��;v�W����������,=\o7m��
���'�
a/��
�X�XT�I!P���{�[����M���_Et�"���������T�����o1_o�6���y�A�������Z��R�$��i��F�Z�9�g�����/{�����V���nz.��-W�\���oz��C
�jI�[�$i��=.7���x�v�3����Y�*h����`�
b��'
q[E��4T���*Un[mS �+���l�i� ��}��vX�~}o��~���!'����	�J[����:���w���A����)�~
<�����>vPa���?l)�r��$���^��/y������6��=x�p�0��2b��!-v��t�����uh� �N�@�i�>��|��e����U�w�_���U�^�?o��W���s��Z`������+VTb|��k���S���!C����N��l���K����t��7��(��u���C�)S�L�6��q���i�"E��Y���9S3m�~�-�Q��������,��V�^�<y�9s��bmF������2e�~Z�����c�+I���������IS�V-���oH-�E�|���[������+Z����y����������5kJ�,��+T�p��y�|�f[�i�l��i���~��B���������^��h��"���j��y�d����]���R�y�m�0O_�c :�i���&���N��yL:�ts�/���G������������B��[�d�+������l�����m������i[������h�6���^�~�'Q������=rp����3g��r� d�g�spBT�JG��~�L������Du���<���|����Nbl��G<!Vhz�o����L:��1�8�
�sOh1|�z���x�"�����&�O+E^!��N"�7m���{������/X�w�k;�s�-[��o����$��M���6m��;b�n��x��=g��5i����s[�S����>}�tx���[���@��1��m/
[�hq����o��h�N��������/�\�x�?M��%*}������.?��R���:u*D�����v��&��L04�Br��)�*U�r�
�s��4�-���wor�������-��'�9�naY�dy���7n|�����w�#n'��i�+;=zd�l����^�<|'��c�^/�p�i��q�R�Q�[�n���~�i�����A����f�l���+�TE1L�L�{ts-}�6�r:n
0��tCy��zd������v�xN�������`c���6lH� A��
��v��-�tu���.,�)�w`���+����2�pf�8JXW��\!G����yq���A$q�B�xrqpBu*����-�(��,>��TU�r�����9�		~���S����V���/�O�`����5~�H�2n�5z�=�:����-�9k����M��<le����GO
W��@���\�����ru��g�/Y�R�K
��)R���L��
��}�F���f�0O	k���[�;r�M������m��R&L��*KK/P��E�d�^�re-�)5�����qsrQY����h��RU�V�J�r���_�$��K�����|���]�V��N]�fM�����Z��[�lQ2n���j����_��rW����Nu�~|���b�4q,���N����i�6,��bL��m�+���1��/�U���O�������tZ�<�y�*U�=�=��YP��[�7�\�6X�g��1L�0<�C����b�X�[�h=���
���*�#��m{,F����R�A�yu��_Z;vlH���%v�[���-���6�Xo�W��y��������{E���9[�v�P������/��bn�5���c`qJYg�_q�o��9�;�����\��n�.���q�����,�)�&2�+�<�w����^Wr��i"���b;q�I���M
�B��?��Epj��.?r����������"]�4a�Q9u�/���jx������z�*?����!T�f����4�%Jh������k��`��q��Dpw��Eb�������Y�,�=G�����E��M/V�����6+w%�1�}e�����E���y����qz�,�Q�R��! ��Q#@C����.]r�;�4�����;��e_���@\�i�X��iEH�D�r����~t�m0���,���`�.(_����)
�L�[o�q��)��n3�.����L;��@2�4�w<C)����xY�{��X�n�����wh������k���-���6��),�6�M����O81���;j��H��;u�i��iX�j
������,Z��Xc�'&$�-N�>�����3���yf����|f��TP���Uw��vRX����2���3�"8d����.+s�wl�lg9�����W�{��K��]�x���!W��S����ze�����^#B��@�w����W{4�?��6�!��S)Q��h���fKxx����e�hf���t2t�s�rW��7�
��N�Y�K�����
bT�����/���=��&���P���NW��&�5R���N+J�$�����2��P��
���\���f`�/j���N[���0:�t5����Un7��s�1$�0����zXPr���+�W18�AI����O�u����Z��;�O~�=�]M85qw<� v������~�U4���3Pmbk�BeL��c�����������a�o��]�{����2e��9��Z�|�����qc{���:��!+��uxd����|��-�����fj]V�[��c����*2j�����_	qIF�����&k���k�l&�{��*nN��1�M;NqsY�)��/g���,}"q]�v�U"�x�+T��/��2�,npZ�lI����s��B���5����Yq���4�$�:�rW�ah�E�T�cs���X�O/S�L�>}x^���V�7�-,f���)�O���1AAA4L�EK���"e���������2���ca�EV�Su���W���������K�<����U�G����4�l�S1-��"�t}u���+L@B�9����Y����<���hq]Xk3��]U�t�D#�����`h����-�y��f����lB����������-����8q����}�5y��#zB�~~���:��=�<\&����k�<��TE��+Z�bC�y���q�����C;4o=�����sap{2���ez�-ur*\�����o3~R�>=�
�wD��	s��Dn�uj�\��/8
*@�P+6n�6"�+�Un��P����������0��'OZ��r��`bV��;��
��BLy*����%��Y�W���u��5���sT��e�C���E�^�(�T�SI��n�S��"W;90 X���;������3k1g*K����1^��`�o���<w	'2R��P;;]�@b�O����'d������n[��"ZM<:$��r<��=��0�T���X���tD30U0�"���XX5K��-u5n
=���
���*����A�4�<����D�AhQJ�e������zG���
��[?_���
O��*���qu�Re
w`W�Z5t�P���@��A"7[�ru��]�;	q�����!C��Y�3�����{������*e'� �W<A�{o4?�k����_�ZK�_n��q�y�r����V��T��?��(~��M��HZ�EB^X��]>��?|��4��
�����5k�g5��8S��a7�J={�����
�5M�}�s��7�}���eB�t1\�������D�i��%6|�n�dI7l�<�On�#�z��aS�eW5�Dv�0��#����E�aw�v
�eXT=?~<wR<�����pS�[-��q��6������#,����w�^�9U�T����4yW�B���X&l��m��4f&?�%L�5���'N���T%�f��a�Wf�����Y3V�k����7<�X���f���0�� �UK]U�C��ZDK3�c���W����A�E\�`a��
�c�t��"[�AY��D����A���5����
���*�#�<��)N��YL�XBW������
/\�BL��6|�������z,.����f�_�v�Wp�MR2�k~�H��X�*��v�������;���1��!��u9!�N�L�����7O@�c��`])94
R�Z�:�/���	/:.}YsW���x����\��5I��ry�h����;Bi��X�����b��2a0����������H�81���?U�T<��/���:������i�O��8!�X,Q�h��Y�F����!��?����v���fA�\���X*�v�u%1�^�&G>��f��$C�X��������p2��F��S���Y�����ph���yI�/hnih���7W��1���h�F���*��C��������1)����U4Q��{b6�By9����D�{(�W����=1�k{��nR\1��=	�������U`�cX�^�I�����u���Pl�y��z�I���������w	1M ��D��|�r��;�p��yJ+Fd�aSa�����?-�����>u���J^)Y�(�`�b�0�YT�f�7��������� �j�l�H8I��%^W�[�k���L��mQ� �8q���8NF��3�������nV�4��0��`zF�����J�5�#�:o����O}m������A����
�`��l�27:�����*����>}�Xi��]��Y]GA�b�����k��a�j��fx�k��'j������1�*T��c��m|E�"�U����q/�|��KH�\������C��	WK���0h^��������^7��T<p8f����|����-���-��*4L�1�^���*��i�Ro
���[fG=�4�e��%�X��%���9�u��O���5������2y��w�)[������m������	WFKz8!�������V�S��VA@�[������;�k�?�{���[���+�������	��b�_�Hz>���������  �� 1<
�l���+o1��N�R���@�"��.�f��Y���+D���;�tb��,�A@����
�,��8��P^Gx�� �� ��.$��0���v�]&<���>:�������8��q�y��V�vA@A@�<���k���&��4��,*���D�+us�<-�zg���D�  ��  D0,_{`��h�C�N:�K����(����Kb��C�JA@b8����=}���Hb8�|��rU�e���1�$�'��� [�A@A@0!�N��s�_��	��NN�����?�V�A@A �" ���j�����  ��  �B@8���=��  ��  Q��Q���nA@A@o! ��[H�A@A@����p���sb�  ��  ���N�-$E�  ��  �@TE@8qT�9�[A@A�['���GA@A �" �8����-��  �� �-���Ksw���rq��X[ccYp�gY+Uz��J��+x����G�����#g�EA@�x��-.�{����O��i�9�-�~�%����Mhq����*��,,8�:)(��  DKb�l�I�,�U��^��6}�P�S��{�/0yr�����iS�9R���4���9�'+�-T:m
�i��	���� ���mHy)_>�z"��f�!,�q���3�E�A@"�[���9����q~�����t���������V"E	X��c����T�_��j����}:��q�"����v��-"m���5v��6~���U���)l�(�:t���Z���[���^*�p��N�1����BA@A@�<����.l���RE-@�J�!�^�_L'�P����!��%��������]�l��A)R���U��[l;G��Us����a(�RN�xL��#81y�d�&Nz��Y����h������  ��  �A��xb��QG���TMPa�\�<���������qb��_�\9:�m������V�T��'O�L�6}������.P�s��3dP:/_���m�S��d������.L:���u��Y�
�,^�d��7o&I��f�j�Z4���d�.��+����n��M]:v,V����;w�~7n��}}}��.��Mkx�*[�L�?�C���)Tp��G���*U��M�<��_�/I�"��V�e���j�8�N>s����Sf��!_��C��q5��/Z����x���z�P��*}�v������V��uZ��-[&N�����HN����9?�4����2�����;we���0�an���p�Y��i
�1K�,~������<���]k5��6AA@A��x�'f]�����M��pa�f?9�������v����.P�����/_�>q��K��������������W|���������]���w�PK�T�F���UcG|�e����.����g�g�h��q��k
G�~����9w����~��oul�����d�Z�j�~�e������Y�n�Q����&&8��S���r�l���B��S�/\�8~��Q�Y�z�O����^
IsYCC�����y�)������R�x���._�~�=�d��e�����x��b�f�F��p�Y��i��n�����3&Ol���/�
`sIA@��@�#N�A��&�}80
���c]����R��H�.-Z�?xp���-���e���S���e�O/\�|��YUg�7�`-]������A�ti��5�W��93��������{��mP��T)S��R�W���q��]};._�r���/��I�4i�����n����7o�V2����N���K�~?r�]�����o���?�7��N`b������������'N=|�(a��_~�f�j���>}��F���d�����o����?>�����g������_�dIN�l��Zo��t��Z�h��:qB����fK����a���2g�l��"�"��  ���G���� ��_
��Xl���xwG�B��Z{g�
�
$�'Kv��UN�}�E+�0A�[w���ql7�1�� 
�y��7o�2���s���f&�?�?K�,�@����y���9y��8���"�����>���%�c;�7n(*�6M��3��b*H��5=�O�Ll��A��%�yr��k���C��+W�O>lZ��rv��T�}��Yo��~]����.S���}R$KV�`������8���v�����2e�S��s�5�}����K���%�!�V��Y�#M�T�l�����  �� Nx�������cXy����-TX���W���ap������;�g�� �
~N��r�P�v���r����^���{�k�^�
(_�L�X��/\���M6qL�.�����c}���U�K�N��y��H??���(Z�^���� �'N�	Lb�����!�c�j�����5���]�4q������\�H�re�(�	X�R�dI�I�,i�R���J�6M���b^�3GU����v��E�&J����+N�������._���\�|�b�
`WM�tA@A@Q��� IDAT�:�N�w�d��/mqg���,M+�W1��9�m����A����9{n��I?�YK��F<��+Vd�[�����7#��X����'OA^��Xq��M8� ?"����
!�w����?��o���KW�D��]���n���c'Nz�l�$�+!��P��b9���g:�����"����t��?W8��$NW�
jv����x���H��N����B}Y�&�i�����k/f/�jAC�"�?y�f���%K��T��s�/T��te�E�N����S�$Z��P�5���g/Z��w��J����  �����O�5Y����u�@L�a�b�/�i)��N�:u�B�N��������YsZu�t��=��%��V���1G�7��=�}'�d�8r�`�/������L�"y�$I+W��w�?��N
��g���W��G����G���)!���{�o��i�A}{>�n�F�;��;��</��Sy�Do��x�2�i��1���x�7#���R��#�u
u@`���3X��+V�����0A���j����_��'M�i-����*t���<�s��L���*U���9\���^�to�lQ��6������]
`��%��  �E�w���%����vm{��
b��`��m;q������G-�}�v���}0�l��f�BU02��^lM��z��Be���  ��W8��=�(vB���|�����v����6D*%��V�7o��8m�k�:�*���3n�-(8�1�A@�7^���`���I�o����K�u�}��m��y��h�����`z]�����K�A@�������:��������+��?��Q�1��������}��"���<���^i�(A@��B<��F�A@A@A "�~<qDZ/u	��  ��  ^G�;��^7K
��  ��  ��p��Z*A@A@��'��#f	��  ��  D��#j�HA@A �" �8�v��%��  �� a'�0��"A@A@�H��p�H�1b�  ��  �@�! �8����A@A@")�o;9�;�Z*f	��  ��  ^B N��zMFN\�bu/U$jA@A@��C����+;��a���N��N$A@A@�'���g�J�A@A@�# ��>V")��  �� =N=�UZ%��  �� `����IA@A@����p�����*A@A@X�b���AIdA@A@��������^�����  ��  n�Sa��X8�[<E@A@A �!`&��}�����b�sA@A@���7�Y%���
�A@A@�	'�	�,mA@A@�B@8�:�'D<xP�D	__�2xbs��mQ���_y�'��N�0!~��X8s�����C�s��I�4��)S����W�\9e������P����y��%KC�5���m[�L�������X�+US�NM�0!��7� ���O����>rU���{��,Y���Q�F��H������M������1C<G@8�������;���&M��c�N��'N��+����W�<y����7c���������#��W_}�y�={��\I�jh��5\$\��\���[=z�y�fT=}��a�����7�6������{/_�|Ne*U�T�zu�Y����y����;�|���7n����Ns�&�-[�n��N�"O��
n���o���c�X"" k�<P�Gs.\��m��Y/�����GUk��6k�L���{��=��7�`M��o��g�d�Fst��<|�?��S����� �"�.��~��e����?$��p��YN�-:m�4���?�p��8�����o�����W��)	m��$^0����\)aR4b��O>�$[�l�d$]�	��Zk.^��Y@��fL$Ep�@�9$H���3g�j�H��"E
c;w�t�%|�c��������Q���?|�����K_1q0~�	���_�/�B�5k��!���&�#�24���x��u��9����6�U�'���������qU�����{��W�.�
�����lx�=�@���_��b����%R)����na���M�p<�<������04�2�T��N�:5���}���%K���V�P����J����K�,I�&�������J�x���@���z+((�t��������x1�A�R�Y��<����������j���v�z���&�~�-e/]����s����k�>y��R�*]_���$�@�-��
U]Z�R�J�d�ck��cG�\� @�8q�0���T����������������w�4 ���w�}�������j/���M�� ����
�����r`i��	)�F��:�w:`�"?��3�����L�U�sW@/��/����I]�Z���;Gn�����;v,X� �U���O�<��J�.�%�u>|��hPa�c���7.?i�9q��H���~�
aZA�A���_~�^�:�Is��%�F��0�f
Z�@�#s$��������0�3a�Q��������;�Pa�"�3f��x�4i
�!X�|�����_R�P5�1O����z�A������E�\TJ�9�7PM�+W���?~.j����sA@;�wn�v����('�@G@-�(�J�-r�����������J�tVGA�8����^
��e�������B�,Ht��:?�
���u�x:B�n��M�*��t��q.��<m� �87�������\��9U�knU��c�(H�(���!a���P����v�B4W���<W����93b��y���H�l����K_�X�����U:1�����_�cZ,�@g����8�Y�&����!���PZ���uJ�e���K3��w��5XC_�Jw5`�G�����U�Vq���/�S�lF/�N��FBxi#�*.���6��I�����/�"B���g�~�O��A��L�T��[
�6�,��T�R����O����?���1�c���������?���#��[�k���V]A��I���,�L�3<V�\i1�\�F;�����P������%����{�����$�q����t��f2���}��Ak�OK!��d�G��K�~�������\��s��W��W�L8m�>�����X���� �����!C�X���%�.��B�����~��N�Wr���1��jK�Y���+�(W������O�34���{wE�(�'��)On��z�_b�������W^�[(Qf�<�t��4�hW�p��B��"E�����|�U��
�4���k����vt�o��4�rh��2��5U8���U�n��E�W%K���m���
���K)�����z��[�8��0T���v���3=�V��9sF/� dLB�IT�J�H�e��Z�o�e(�������;��a�pDf&�A6of��3IF)�z����������\��������1`����Sx���x�'O�����"���[^i���e��Cv?��3\��iBb��i���^{��+�	�e�L���$�`���0# �8��I���n!�NDy�j9��!:<�YX�JF���j��BH��������W)J@�T�j_��K4N�)�����W���"��'OW�V��1l@E_�m�%�����kX�hh��M���3W����$���!�P��A���b���#',�UdE�����`�������F�-6?!g�6��\�<`0cF-��.eg��A�(0J
���L@@>i�]��g��M�y@��T�
Rpr[[n�kS�2~��� Ot���A�����fm�����+2�pX8}dg\ZJ$	���t��"�bW4�Vm6b��<JX��9����H)N������g���.O(8�����f�$E������k��H�~,����k��j�
w�����1�������d���]�MC�Z�S���B^�Opj��M����������@F^:���%������aNW)�6C.Ms����-!�M?�]<s<��*"��N���BnP��q�H�)���+.hQ��,8��Tf�e���b]���QC������0V�<�H�����6��'O����/`�MO �y���pe^,0�z7T�t��zU�:u���9o�7�|��X���d�X��g�D�	�w�Z�>A�!�����(d��{�����3����  �E@��n!A�_@�XGE�Z/�"ta6,������e4-M1?Y�6p	� zlW��y'���V�c�
��'~�G}A\�8e���De�Z'�o��L�"�U��8
�V��~�����&vtR��N@������s�	��bFU`�q1jB��J�9`@O��*T�������e�����Y���I����-��2��w��	nF!�Z�����9����|�*�u{����p>�PU��nB;x��(4�gE�W�^���5hFRRA �'3tR0F#1�]*l��7��:��zWPI��,|�j[.�N���+7-U����&�P�lW]�>f�c�59r�'��,��>�f����"�;��MK�f��%B��p�3W��6�p��b�h�j=�XO�u�q#����hf��r	2���3[L0I��xBa6�q����VY��?�\x/ag����"�����EN�^F�[�,KE&�11���%�����fJ�V�^�'s�$C��A��\^n��y�K*���LN��w)�mvf`$��	a�M��\)tv�kv���r.�*��6�P��2D%a�
�g��Pd���j*
��a�q�������/�xY��T��
d7���TS�@��j9^�j�	��yI�rm4����@�dU����V�x��!�����QB�"����hk�I���E/�yE��M<&�gjq�#�nB������bL��E�"����jV�$�6�
"P:y����@)�YL'`���4e����[�%p��m\�����W@���!�p��?�����\F��t���nl����cy�����sx{���JQL�{�GOm �4��SM!�����g�/�I������#�Z�N�)<�`b4���y���/W@�NI_���S��?DTk��1�J2��C'�b}!e	�gC�$T@��c��F��ri��m!k��AmY�dv����E+(�,����TD-�Y����h #C�ur��i�8;��Hn���L����r-�] ��7���������^�rP
!��QA0&�mS>���e�BO���zW�N�j����9�s����D�9�~,Z-?����'�N���K�s���q`�6�\��_A@��@�7	�?�[��\tFc�t��&T����hH������������K��'A@"mGj\�vv��8������c��F\�nw���M��H��p�H�1b�  DK��/��Q�^����e��QaF�����"4��A��.�z��  �B@�bs����� �}�^�0bb[
�/�~M�1z!@;K3	g�������W[�5����p��w�Ub&�T���K����2�sq)(n��	���  ��  �@4G@8q4�`i�  ��  ��[���HA@A@�9���yK�A@A@�" ��-D" ��  �� �N�;X�-�;=|�����D��X>{���#I{�5k�yG���*��B�,T���b��L.����3gzQm�T��a���
�1�z3_EVU����v��V�f]�9�S�N���@:n����1���iHG��R� �5'�t��������S���rC)�e�y{n>���0Y����K�&��}�e���f��MI>	������u�d���'�Z����@��y������5;Y�d_}����
6��uk��}v[�re��eg�F$	9��sn5�a���N���r>���9��W�\q�-l��[�f���,_F��y���r��Y388��p��+U�T�zu���C�n��a�k���:t(���e�d0�|��*�i�����2�F�f]��5o�<{��f
�O������3��F�N���~�Y�n]�|�����W�E����5[�|9����cf8}��?/^�|��m��r�7�&D���[!���Z|�I�j����:.�����.��GZ�jN\-�u����
�����
�^�v�z��[�?�!}mlf��Y�|����+���Fy��(~��M����{����i,#��&g��I� �RN�o��1g��!C�|��v��W����$��r���5n��mq��`���e�����o���sk�W������o��S����|���jl��9<8�����~{��������_�u�n���ql<����k
�]���W��:Ca=�+�g�n�:����g�1u�}����54��i����2�s#~H��M$�"��v�&U�"6���K���I��'�n�I�W�wz��[
1D��u����Js�q@��/n;�2���q�l�oT2m���b����-�PsbC4��*����q��7_n��%RDox4v��g����:k��c���+W>����un��y
j��6A��ca����yS�qbj���Tt����H�={�N���x�k������:M'^���;W�\�f-����7��7����g���);vl���`]�M�#F,T����K%K��6����M�4�"'����
�\A ���>Y�zE��>�����r�����v{��NqO91u�M�����/�>c�E]:�g�������!���]��o�5z��?���l������Xl�*���w����w�����cn�i?e>�V��vj�.C������I�G��F�n�6��v�Z�r�.\���@U���S!�E�M�8q���7n�H.T���v������/'���SO�8�O���X�����P��*T@U��Y��Y��	!h��!�}.��{w�`<�HRj��I��/��0�8�6m�4f��X�b�k���u*w����U����RO�>���/����#G�Z��z�X~����U����V
&�~�m�V�z���������K�{����6�/��B���;S�L�X�*U����k�)R4H����13�:�md�(�[x�=����aZ���P��@`����0���o����
e��!�J7�-��k�=o��''NTYw������eK��SH-�b�������W(�Oz����<�/��2���HwBD�;�e��k�\��w�g��D���R��T�;v,X� ?��vM�>��B��.]ZK4k6�`�������G��K��,_�o��F�������\�ra`�
��J��� 4�������=z0���(�u�V�-�F�/0����v���!_�9RO�9q���<-{�?bz�;�i��������^������T�6\����s���&W����G�G��^��s��%��j���{GP���������_�����P�N�qQo�F8�O.d���7k�8u�a�9;o>h0a��-'�n�������L�s-�|��i1{��*k�/G|[������U�������Y{�6?����=.�g���p������/	~����mG.�5��R�>z�S��D��8���[$*�
��q~����-z��87
5PL?m���z��*�k�������i����xrC��|W�-��k�����8'V��knBy��N����r}9|���wd���H�B�?����Pe�Rp ~���,X^.���R2��Pu#P��*U�,fH���NX>���+�G�A�M�t ����;��v>��St�G!��_���cB����2t�����
~�����fX5b�%�O�/+q�*�!��|�
Q%*.B:
Q?��~Z��E��������A�&�	�]
x5�9�Q�e�e!s3�
���� IDATF�H@�*�
RWu���E��F�6=�t�����."�.��{����������V�x��9b�bf��6XEG�3.��}���g���p~�����Y�
5VW(���51W���`�Nw�(�w�su�X�B]�����^�4��KT����K��[*)���#h�~���ZH�����9��X\��wA��q���I�iw���,X��e(�#?�~�VRd������s�5j;u�c�u����k}��E���;m�/�(�Q�/����/���j�'3w�&�����h���]?�Jz�9;��A	4�����U�F��c7:��3v�J�i�:w���.�C�8��~�#�����W���R�x�9J�H])o�/j(�)�����Jb�X��r�!���VU����h�_�G������e��F���B����H��V���vE��F����'4�����s�4�tHa�t�x��W�pPYjc�G���gU��..�hO�1��7)RD�x��#����S���Hkx![X� 47�z��*����`W2Z�5x���f�6���o��8������@<��8�������?S������9j���D$j�}�u��\�l�Mr�
�����v*lHt��N�Y����
^�Rpp�2����e��
, 
U]N
PW��y�<���X��K���%�2e�� 34��W�E��^�����X0G��(���<I�*�Y�9VM7qL�6M�k��q�(��90���ZV�Y����<����b��
��p�zs�%���0O��O��ux�V*;�o��\��������q�8~��R'N�q�R�fJ�"Y����g��9��;�H��m/�,R��b�<7<���7�{;
�dI��v���^����2k���^��8��U��n���J�w��>}�a��������Kv���L�9q�U��|������(2��2� ���>���$��w����	�/�3M��)�n;���}�������D	U�3�}�p��D`G��r	��%�����r%y���u���Gy��*�����~������
@
��� E��R�C�4,�L����*�XqE�F�DX��k�x�l ��"� ������x�,7��Rp�)��C�E@5o�VJ!�O�w�A R](|��P��/�<�����o��"�\W���E���������mj�.&�D����]A���6�V$����2�q�Bg�
4����1�b����O��
�u�Y���<����f��9�3;���F���g�^W�;UH"C�������s����iS�����~���v����?����>����*�Jq��Iy��-�%�1��\��S���q���'����/�/*�5�_��73������Na��8�q�j������37?���l�������!y��
�]s�j�f�"���w��[:�Z��������Mr4�V�o^��W��,�%��,9p���Nv�1k��)qCV;=�7nH��� �c`8��l�����<�)�X|��'pGu���f�{d��4���bo�\�N
Y��B��<yN����D.�+r�B-����^M���0����[~k,�����������a���|�L`�v�&�]�j3Zx�O.��
��s���G�"K��t`�C8���3S@�si�2����5��������>��c<�L�dI+K����q������u�S�l*�~I�����K�i��Vi)��u���B�Z���i����XKV�#`�Sz������
x�-m��]��oQ��G���\���+�������������B�>�]0������z�o���^,
~�9E�ak���}��vN���tI$���Y��29���}���i�(��Y&
��*$s�{O��������[w�%w�������'O�4a��"1*���1�!h�>�c���X�zq���6*O*�$�<�+/�YRf�A_E��7��v��Jn��W�_,d����k�A�	�Aou
���rW��9��\����g��(Z���l�XG9����{��	jv�����ZWv������4�N���,!�D1K��`b��+H-��{�E���\I.�^�5�P�H�
��C+�O��
**�"HT:��t�z���IH��r�{�&���\9�g�����;3���{��wf���\9�^r���J� ����1uR>*�7h����#���x�9v�i
Bk�'O.��rjY$���+�n���
�+���C���#G�d��{O�PXHD��bbN�q���
��x�����g�&
���E|%[���!�W���S�[�f�
9u���"����r�R��7�#���Gr����nzQ�y��vD���$�����b�~��r��9�J��=�����}/"��%\�1~j����tLJEt��Z��1fEwH�aD�=zF����%|���*f��z^�!��q���xe���M�y<Px
���)D����+\���p�����x���ah���v����?�����z���z��k3f��`��������u:	*Gh��	5���x��`L�p��.�%��H�h����U���D��yu"���`�����pl���
^Gr��@������
���PJvp��1r���
zP��vp�����P
DP��[���g�Ub�0')��XO0p����IL�-,G�U\����'$B&%���i���w�_W���&����B�r]K��)����i�������2�o���uumXb��+����_��lw�[$T^{�nYD�>�d�e�������}���[�lt�&��������A�t�1-+�$�^�~s-��N�>w��7c������B�Q.o��_(����c�����HL��FI��*��������I�����&j�3�������zs���1���sC�=k�V����u'��xR�/~�?tL�~�����
>�B�B~!�BS43�� \T�T!�U�_D��	,��x,+�;@~���ZN��G,���
"�����x������_;d��~T�0y�d�B~,�#�����!8/����Vh5jZ+��� ��%D���Bu���cXn���Z���C�!D@��9U��q��)�a��;����*�"�L��K8���
p�����!�K,D�z!X�J��'"�2�R
�	'���\,.�=l������F
X09�����F�
@(���;7����9����FT�g�b��6
����@�������Y�Q��w�i�]���\�b��{������p����XL�B#aL�mG�~8i��ip���z��[�C3�[%<�[�DY4j���(�lT@Fx�-D�a����>"�sRQ
�-)�l�iW%�"��lE0�Q���2�Ql��X�{��-��������uk��0�������6�=8���&����2���wxJ�~H� �p,�g���&0s��G��KF��ubu�c	����R����
i��L}6^m����b-6����C�/6�9�����:�=��YQJ�Rb��+6y������t���;!Q��0H�W��#�ow�������+��p��=XAB6�E��~�D|�>�b��������������+)Xt��eKL�Q��R���
g��ae3�]����rm�XP���4���4�&�c��}��/R��]!����^C���a���	�w`�7���������p4���I�ZE��[�WnF�������$@$@��}g��O�o����so�)������_k�TiJ��m���l��f[��Ds�n	�����E�J�����wS��|���)_n�P�T7���Cn�	�@�!�`����<��q���R�m���������R�H����Y~x�K�a6������^?�gy���~A�u��}6�Ex����n�*�t�"�f����>��$�K��G������/��B��s�<a��g�����gV�; ����F`��Y;vH�b�5�0�]L�B*"���; �f��":  ��F���mD�    ����xb���C�eH�H�H�H�$���h�/$@$@$@$@�!@M�j,C$@$@$@$� �&~�F�}!   �j��Pc    ��5��4��	�	�	�	�@~P����	�	�	�	<H����d_H�H�H�H��C��8?�X�H�H�H�H�A"@M� �&�B$@$@$@$�jM�6����F$@$@$@$@^"��u��n�SM\�l�������i�H�H�H�H��;O5q�6m�{[�    ��{�*m�	�	�	�	�jb_-��H�H�H�H����A�6I�H�H�H�|�5�/��J$@$@$@$�
����J�$@$@$@$@�D����F�m%   �jboP�M    _"@M�K����	�	�	�	x�5�7��&	�	�	�	��/�&���b[I�H�H�H��A���Ti�H�H�H�H��P��h��$@$@$@$@� @M�
��I$@$@$@$�K��}i��V    o�&�U�$   �%���4Zl+	�	�	�	��7P{�*m�	�	�	�	�jb_-��H�H�H�H����A�6I�H�H�H�|�5�/��J$@$@$@$�
����J�$@$@$@$@�D����F�m%   �jboP�M    _"@M�K����	�	�	�	x�5�7��&	�	�	�	��/�&���b[I�H�H�H��A�SM������*$>�p��<��m�����x����I}���D$����+?C�7:���;�'�^Lt��v#�d.��-l&��x�'R2fH��FR�o�
v�H����/�f.�T>j<�5ut������kt|���]IL�I�T?���`vf�������d�'IYk�&�����K����]��^����g1;��&�����a�G\nr�C��PAn�]�R��N��e�xsp����1gSI��jb�SD���VF����f������?��0����?36jZb����7�3�M��i�l��s�#�nww+�v{O^�������_�����������M���gm�!,���K��px�����Y���z������wg<@��Tw����V��+4pS�~�/]2�_���n�9=��'��/���D�S��Z��/R����gg���Q���[�gkI�H�>�T��D~�r�B��ev������O����ru4�_D��?M��9���;#��\��o��L�K���6=��(U�jA����{�C"c��v�j-���u^����}�5]8���>�_�n��l��v�Q%}�w�l�S��5KZ��P�����>�|��+*�&6&��_MM|���5�	�,��O��U���;�VD�
2�O���[?��<�JT��q�gVx�
o�`�d���7+���}o��
l�r�91A�+��U�Nx��K��'�������!� %�����$����o�[��7{K��B�j�-�uWG�K��sS��4�)���&XY��}i	+% _$�7���������?���B�_���bN�*�U���Z�MD�g�OC�E ��i7TE+h�xK�������9I�8�<�4�$���B�����5S'�*�aA]F��/lZt)����w.4'_Qh���cB^����T��xfw����C���FM�g��L�SH*
���N��U��tet��'GhZ�$J�����C�����TT�*^)��?�2�����H��0D�ed��G���3�!<e
�8��e�5Z���~{�pt�E���O��W�S���E�{��\<���bQ�����_M����n8�^Rs�e��*������ms�j�#(Sz��z]P�mp�q��bv�d����z���	�����g~&C*B��h�L���NG?����gN<m������?��h<�'k�$%\��J��+{�"Qi����m���(k��"(T1u���PY�l��'���m�F��ma��1������!�qbD�H��S?�$1��y��2���Q�����;@d6]<��N�����Lu������#v}�v�1�%3�U���_������2��x�����%.���4�����/d�����j�!KY����X�H���K����O�������6��g�(.C����S;-��*MC��I^$������2]9��RG�7�����=�������_���m��������zd����&8\�w.@/�?X�p0��B��q��_?�t��B�A=��9�:��H��*�4�WN��1����Rq��~S��pDy��B��x��WN���tV�%�	��B��������u>�o�+}����
�)�R����}���3��11|��[��4���Z�+'qgiH����;��s3���?���,.�N�����F����%���^��s}FN�	�	��+�����Z���NS�>�T��*�Ut�9*���DN:�X_S����z���A��Q�E6�R<|�u?S�����O����F��2(��|9c�`IRc��R>l�����"���\���4$,~�m����
���q3k���{�IG�{F?�-5�P�}����x_�G����;E�J��x����������6/	b4�rk������
��2�i���A�?��z
���E����)z
���yg(��Q�#��4]<�>�y(![&b�t����|]D��R4'������6R;u|G�TWn=#9�V{���R�<�v�����i)�*m�w��*�RF�
�7��(��p��]�����-3�����-�'��~E���i\��du��~�n�-�BjH������
] ���]�E��\x��6�����N�o�~6s�g��������g��UU�*�J��6��+v����O3���+
�7G��W����6�����0qS��Q���s����	��������~����I>�*�p�K919�������7	��tK?�pW�I]�.B���]B�s��Z�Y���c�Ck�N������qq3��ID�J����"��j1v�� vs!�����enT�����7��P���.���u!==0�M���^K���L����GM�Al�r
�v����@Y�L�G�����]qb���Ow���"���p������%�\Z�/���R�u0����������1����	
{k��Z��RPP�7$��������d@�n����P$�QO���yB��$@$@�	��&�XL�����R�C�_��#<��SV�.�Yb5n1��m[��fP�p�EO�4���z���d�t�g��,=@����
<X�l�<O�5�m7 �Q��9~n�)?<���������x����+R2~y���������W�
h����P��~ ��Y��m�m{�|_�n������n��n�iI���9�g�<R���3U�/��v�{�?�� � ����.W�1�c
�.���=���i��Pu���8���������?�~c�fd;������p\��=G�NSp(��8��������&���N�J���AO}(�����g8��6��Peti<@��
P��wG��t0���B$�������R�]�,����@�c���fh�s�H�6E���%�L!}i�+�Rg]_BR`�t�!\e�f�0wC&�������p'�a������$�����8-�;��/?��5��B6de�����:�}�S�!�3o�E���(�`���$5@��|����i��1��{'�#O�V*�=�
,���gK��x����l�iKpk��T�ng��RP����CH�u�_M���tY���+�����V�$���V��L�������"0�.3?�	�	8%�M�_��W
I�O���F"�x�S���8��c���l��pL���
u��~G�(���������u�)�3Y��U�W
w�H��d[7XNf�����b-��
qH-Y��_��S���;�|� IDAT�}IJ�
Eyu�"��lJ��p8���X�C���(����/�)��5��9��:	����>`��s��]�+K�G�0D�!`��������o�Q��fhh�<N?��D-9
@��GQ�IE�S����~f�%�*FMxg]��M��XER�O�jw�8$j�E�	��LF���g�����	M#���h���Ry���d���`S��rlC�S��E)q��e�I]n��>*�" ��u�����
�t�'+T�#B(�"���$W2b���O�����#&wz�!=��Iz^!��	1'��T����e������*@��2��/
����)���C]���U(B�.��
�v�F���x�[���$���yubR�%���*���	�	xH@�a>�l��"�^[������v�g��)���
bA�^�_��.�W|>VH�m�9U��:F�:6�.�=������b�I��6f#L�8����-��-��v�|c:�/��)�m�t�f��rL�5%��������`�����!�R�`8����&}�?*���E��CX(E���H_�w�K �8�7��j�������u�� X7��p�	e�jmH)p���y6k��M����������=�/Y� TL�2��CX-n����C���b����6�;��J�j1[���H�V���\��>Z��#���i��LC]�.��U��'WN��vmru!��i�yu��q���ai�>�����:nt���[��g�r�_�hf�$�}��3:k6K�n7�;dq���{x��@�����i!��t���
G6B��G�Ss~�`6r"����0�H�H��@�4�R�ig��&%'��0G�%�Lf�7b�<G��n���~�!(�������� �H~7!<����
Y=D��}�ZBD,~�,&76��B����{����4|�����B��l�|tK���MY�6L:j6�<���}�S
d�$������
DY���_�^��f�7��G��>�D�4������:���
����#�?�0�'�
���u9
���)
�1��oE�ni^)T���bN����q�����7Es�@ wl�C��=�`+�k���3������m���Z}TGE��lb�>3e�9�1�M�#J������LCAq�y��k�8c���Yg!3uGTL�]<�
�J����u������o����_��#��oz4���&?�����j|e!�(k�tLX{g*t����L# �O��-5im5��d1c�}��!:��b���/���:h������W�!'�w%+3� �o��#&f���;!��HTj:�?Ov�������n��n��n8��U8���!l�_JUg��|��1�?���s�l
���[o-�G�J"9��
���)�b9QH��"��m7xmqO������pL.�����]P�������:�M���������T�z��rM�=q�R!��_>�HY�n��G�"6/8����c�?(R��X���k�v�crb����w{�:��Y����#�������X�&=�_�Q�����XX,�����.d)��z�s>���wu����U�Ys:#�<���G�p�W��u���/�_N�d�g9������y�~��ty���*���!���.���9��;����i�L$ ��+w��,�L-�~��9����KS���E�7������r�Ol��r;���E��:7>�;�����_��k!P�v�X���YD��J�@����!�����[�g��"�Z�8���X�	�1�G�T^W6���<������?1��}��>j�w�����9ar!�]��^�m���]�������v���Ex+������v�����a!<��1b���ZL�g���HuEi�+L����xa_U���HnQ'���Z�n��
7�`������VY��IS�����`��������.<���*������l�	t���jU�9�����$��RG�"E�Sh
��-�kS`���UY\�S�J-�=��k�M?A�b��c��;���/�n�5h8�/���3on��_��=��C
f="���~�� �`�?{�_8E�4Cz<����bt4%��AM��os�3d�%�"�)����
���2���F��`h1�A���o��4��Y���;���K�S@\�����.p�(VK��T�p�+k����	���\MfpU��$@$@����T���"��	�����5?`�.�tJK�i�!�Oi��u���a�3�����
�5�Y�G�*����T�)�6C`�~],,���4E@�6&�(JiM"�����g.c��b-^��xu�:�����Sr6�?�rM]�J���e�?���pa�X��|��[��Wib<�;s�Wbv����&t��|�����"�5�t7�R�	���;@I��HU8FU�|@����������OV_�W����������=���o�m��%���|6E�;��iE��BP�����k�r*��c�;��o����S�l; ���bqU�Xu�Zh�n�g����
/��V]���lH����6�5h+7�|������*V��2[
��Q86�|4
�!�nf,�jN������_#���%!}���xV�����dH��y���N����[��O)���O{�K��[���uK>�.����#�[p���7f*���n��5����Y��-��;��=�f�D�����a�z���'�9�����������6��1o$��B�6�c���9�6�Y�����9������iv[cJ,�����m��)h�O�	B�X�Z�KKPc-�"�7��<�i��l�~�BEP�um8K����J�R�pJH�qX{���Wh ]S���1�
�E��XW�Hk�!�A���$���+&�.���'�b�
\�Z��q,=���>�������_;U)���-7���n)���������a�Cg2���
u ��,=PT�u��ek�i��~]`��V'f�bj��^D7���e��ku�j�o�D���)P�������>�����o*����kz�R�c�&�&��
��%X�
qoiN�S������L���&������S������u�|����9����o��E9&�	��E@�w2��U��_�����m��4�y������}W��N}���a��0��^<��$*������;��~�;���	�@^	���,��I�SG��j�������!��H�d��|��
�p�Ko@�F���z���:8�5M����	����\O�v�����*
j��. �o���zV|�	`U��~�#W�	5V��'�|s#��Io�/'1B�#�p����2��!  OP{B�yx�4��o���?B�a���t��xP��"xO;&��
�/�|P��~�	�@%@M\@���
�m�w	^�L�$p�	�[z�M�	�	��Kwg-6��y�H�H�H�H�
<j�?Dl 	�	�	�	���	P{0��	�	�	�	x��~��@    /�&�2`�'   (������$@$@$@$@^&@M�e�4O$@$@$@$P�	P�!bI�H�H�H��L�����i�H�H�H�H���&.�C��	�	�	�	x�5���<	�	�	�	�@�'@M\���
$   �2jb/�y    �O����H$@$@$@$�e��^L�$@$@$@$@�5q�"6�H�H�H�H�������I�H�H�H�
<j�?Dl 	�	�	�	���	P{0��	�	�	�	x��~��@    /�&�2`�'   (������$@$@$@$@^&@M�e�4O$@$@$@$P�	P�!bI�H�H�H��L�����i�H�H�H�H���&.�C��	�	�	�	x���C���_�n���{��/h�X�F����o�m��nYa��	�/��Q)�F�'O�jR��S����
�mW��^o^�i�h2[`��g�2����F��dN�����Nn
�����{����yX�|[`A    �#��&~�r�� 
4��.���*-�9w�Y����6�k���K"q��c�'�=����"�l�@�~���WS��M���5��r.1}�[m��OM���`��.�wA�Ql�0]�)O���H�H�H�H��	�Q�D��B1�Bd�b�6����V�L�����UG@ZV��Oc������)����0g��n����!g{�I������3�	�	�	�	<H<�;�sl�P��:e���)�����wH�[��
�]H����U�/�Oz63����G>X�oi����}f�&�nUu���K):x����T��������7+���`���h������]����Z��
�X������q�E�&�;6o���a��x��
�K�4���J���vFh.�d��RlT����+�&   �O��'��B\5�@����2�/q����D��Q�O��c����XC�^�w�V�����,��']Vh�G��
�%w5��}���KM��bY��P������^�fD6C�w���z���cV\��1����1����E7��������{��������_Y�H�H�H�H��������{�^s
=y-�g�W-�v��am�������S��Z|�E���-z�s���R��p
7�T4B��	dC��,��h_�UY�>e����J
��#$x��%��xBDK#���M��`�M������5��Q    ��C ��X�c7j�~W�@�AP����w-xBV��3�,o���U�N��P�]�!L�k�P	9O�R�N���X�S�g��^}��c����U�����W�4���E�`M��:g
	�	�	�	��= �����b��%��6c��]������j��o�X�*=��P(�f�,���.����~���]�1~���_�m���H�H�H�H�|�@�5�C��C�g�}�������_j����?R����b���"�<t)����V�H��d)�Bl��W����
d(W(����[o;s��<��9I�H�H�H��#��kb�hL_�<o��+����CxmG�j%V�����w���Am����'y�����fL�9�l|R�+�r:��C`�����Wo4c�d�x`��,�= vf�a��kiYH��Ew��ad����@fL.
P��&���H�H�H�H�@�4��_�>�.L^lo|��54j{==?�|\|��>[�F�g������l���M�ag������P����)F/?�'>�u�o���C�*�.d�h�"Xz���uU��#b�OLZ/��i�i�������6e���o�h�Pq�2���cVx{A\���*�������}���O�*��z��{��u���<����:,t���dDZ�]�G�������W��r�Qr55kn���|
�	�F�	�	�	�	�)��m���� �g�fy�lH�H�H�H�H�����z��SG��j`O�����x^s���U��=�5Q�	�	�	�	|�jb�/����$@$@$@$@$��1��0�"$@$@$@$@$��<��t'�x    ��+�{�v�����E
����0�H�H�H�H�W	8�_���Q�s��j���������i���7����i�^�9oo���f�$@$@$@���1�y;�����6��'�Z�p��/��M�3�}�A��eE�������������F�'O�jR��]�=�cW�������;��h��:����2Q�X �����5��6j�//7m[�������^2��cU~�|�M�[~�tb��cG.���4��f�j���e�r��?��]�-*��:F�}u���r���amE6�Z����U��l?R���7���]1��8�I�H�H��JRA�
b��T���Ah��]jw�UZ4h����-;u=ml�����D"L��k�~�$�a��<v�}i��go@�@
�C�o<Qo��5CZ���v�bz��x��k���*�u��.:y-�����&>�z��Y�� ;L\�e0��
��<�;��o!I���k�����e��������Uhz�-�wa����t�0���d�r�������/������]�4���0�������~��/���
��E�m���H��Q���vGs�&g�����|��:�$  �O1�Q�D��B1�B�f5�-��B�c�[�2x�^�l�hO���;�fo;3�gY���+5*_��9������O���<!��A�j��t_�n�������-�x��O��=_�T�,����qE�w�Q�^Y'�x?����T/��������7k������	7����X�mW�D��8�mM����
b<�(�r����/���S��mp<�a�n����!g���C#�F$@$@$p�	���.z�������$�-��v����Z���Y��p��sw���W7���9P�*W(���d�B1��:x���G.�t_j���w�j���������o�XX8{#}���f�D�F���l���Z,$�)��������R�w���GV��<�/|�Z�����{!�F�{���Z��p�s�>�u�F�:N�������������1[�R:���5��h���)x���<s���o>��5G/���`t��rJ��'k��\t����-�7���N\Yw���7Z�X���0�;��X��-����K��Q�,^�m{�h����x�j����Y���T]���f
N3��q�����u������9��~7(W��jA���]���&ed��h��,"�W����/;�]�{�y�4�P���'K�	�	�	�J ��x��C=���D��'���>��
A����9|9�lt���SX�PX
&>|)�����A��k���_�}����<Z�p���#T =�8�������	�[�s�&�T���R����w�w����A���N"�A�*���w�?\���a��'�dZ9�q�J�3����k��$8�;}�n��+5JF,���O�����e��R��#��|��C�,��po<�\Tp���5�Gf��&�WhY�N\M������"=Y������9u
��B�zx���A�m���Q������>�7�I���_m&���+McqW�`�VU��~��L�������4���������X����>~5Ru�s
E@db����������w��<���+�i��<~%�y����r��mG^n����p�Sr���B�MhS��>����"��c�F����P�x���[Vd(����@��v�
P��SH�=
y��`����������A�����14�e*��������B�z1��������/B���P��BRF�����,z�m���/��,�����AJ�/W�����]�m��O$@$@$�my��xo��_��"��4�������V,�]��'y���;V$����?T��)=�em�
�9�"r
������=RN���4v��D$��Q�(!�Z	��'�"qd������JJ���4:���[�J^K�Z�'��w����S2�O��z��Npm��r��{.�nhk�Ox�^�_w$�����B����X�����BC�gZ�a���qpxT����iQ���r{L|�R�c����������l���C%N���([�/��H�e�����q�v������)��&�<���z�ML����=�n��{]D0�������/������}����-��
E��Dm�Ik��
O�,�J�f@\v�S���g�MTq�����]""�����,�>v�^3��=�m���i��w���@q��S
w8��S6��)�6�,���^q�rJE���
@��_>�<l��	�	�	�uy��s��l}�
�3z�����%W�'yP6L�����F�nG�A�wx�����N_OC)�[Q���s�z�]0d6<�"�����N�R�R9I�m������V�� ���nf�g�~T���|�4�"���t��K���Z/�5����U��g�x�u��9j�Q"r�D��hIDAT[Pw��IS�l7��]�GD��������'����)�������V��"���'�@B����v����G��M*��o7B�+	�����u������"���!����<�t�Y
F\f@�����q����m��7D
��I�>�bi�L�tz�[���*���7�����D�L����V��1���+�6�����i��}�-�4�c��R����(SH�H�H��
E��Mu6��������ZH�H�H�H�H�����������}��H�H�H�H��%�<�����.    ����dVA$@$@$@$P�	H�#.�C���	�	�	�	x���q�R^*�,IEND�B`�
without_mouseover.pngimage/pngDownload
�PNG


IHDR�HG
sBIT��O� IDATx^�������9��Qr� " �P1$��H�I$gI"Q�H���H�9�����qfwv�v��P�x�lwuu��=3�T������GA@A@A #���(W)# MA@A@����-V�@/��  ��  ��'�Q ��  �� �p�Nh~�����_A@A f ���'������ H+A@A@b.G��7����]�s�����  ��  �H�����y��A-��  �� s0r��B�c�`����  �� C�}'bh�K�A@A@4��`A@A@��'��#@�/��  �� `�'�5v2&b���o������'~~O����Kc�q��I�� ~���c�wF��=�V�&N,k��@����A����/_��7o����&K/^<��-�@8 ����oG�8�-K��)��C%�R�����%��c!�������k�x5��[�U`�����'{�l�����M�<YTm��-�@�C@^�E�>����w�=�(Q�X�W%5�G�d��������E�  1��X��c�H�A��t��x�cP�G��B��u}�dIc������6	�� ���8����sn���;w���1@��<yr3�=T"�A@&?�������d��4��R��H�$����}����ZZ(Djx����(�C�����i�JbtB���'I�
'�N]C��,YR???�i����f��[����e�f;M�Vb��>|��|_wj�<�c������n��?�
s�;���=Q.����Gs�PA�c�T�6�,�������s��y��}
��F���
�8G��a���'�|��'�>�Z�*m��y��I�O�D�f���  ����p���-�0��[6jF��T5�<|�N#�
j�E�s.B�}}}����1C�C��<fN6=/J��a~��}7�l���W=��O���>����8�������QMRX�(�=|8s��s�/���d����~���)$#��@�A@��\�t>�-��<v�����-�����9<^l�ga��>��	8}X����S5�sp��w3���$rp5v��T����HR��^~�����@�n��l��,�V���^�NYW��-1�����F6m���>�
G1��j���y[����8��i`��IR�H3�'�d�T��>����u�=��+J<��\��Vm�����}R�z�V�m���{�.a��,�/#�������mp�����j���/������u�~x�O�c�oB��q�$���$;�'���3������	���ti��+U���'K��]97��{��S�F������nX�v���,�
X�����7l�0{��0��?����2}�A�-CG�)V�`��U~;*a���'>%�$�W�x����AAY2fL�$��U��x�
B���Q���589q�����4��3�8�^���
��t��g�&�J������0y��]�._����+U(��E������[7*"s?i���[
��]+*���"�9v����q;b"#�@dC���{�s��eC|�����5e�a3����;����P	G���E���OG��U������7V���6rL�����(m�������e����T��0�$N�����R�{������"U��9�^�1��]5�y�(.�u��E���7a���|��f�S�0�'v��=�t�����H�(a�R%��R��x��=|�(q�D�&�l��`���?o����4��?�O��uA���L,Y�
�zw��>}:J-Y�j��Z����/]��D�bn�(�~�a�V-U�X��U��m��9s��q���!#F����k�F�X�@�a�&���������C�<tx���6��j��+J,�K�  Do����Z����4�+������M>2(�����!3��n��W�����9�_��f��a��+U���	vDO8N4J�`�!$��o�])�����U���3g����o+�/��.V���Sg�=x�^��%���p��������������H��v���o���8Q����}�q#���9?^�xi��E�����#{������Z�n����F��/L�u��G}���k�5�Uy�ZeU��_�>z�8N��U+�����hi�?�]������/fL���GM_����l�������d��X��{���������9v���g���N?>��
��'N��c����G�x������bQ����������o�"�>i������|��#���f2�����o��$Q"�53l��2���Z�+��C�7m�Q��kNkC"1����X��.��a�AF"������c�����1K���E%�N���7�/�i�YF�����K���q�&]����[5o��$t�z�*��?���5K�^=�?>���>�U��.�+%�?����m;v��?c�t���R�����y�V��_��H�L���c�"EHd��I��o����'����[��R�����o`��g����us�sG�������%��/o���z��{��q��<����l����J���t�~���h1�����k5��n���_�Vj��-{��S����e�~������?{�����~����O�<i���-^�T�P~AH�+Z!^�fm���e
��
�@�D`����S���`�I'������l<5��9r�=s�\�|���<(a����<q�d���&'&b8$|"�p�V%��I!n��c����n����W���Y�Jc���w��?�O��)��0l�����o��J�$���K�.�����G�����|�����S�J[�d�u�d���V�;vb��)N�kUW�����X��3{Va]�!��v���������x��S��n����N9�e]�a��oFN=�
���j���{��u��Iq�~7~�������F���3G��?�����V�}'N�gA��������	I�$����g���0���Szv�����am��\�/I��~O��&M���������czD���j��^���={���2��F�)����u'��S�-����.;b�~?���d0��/������I�����r��������u��Q]��,Q����S�����u�WJ��X�<�����d�����.����%�V��;O�\����;p����H�7xh����'�g\A����{��It�+%a"��[�����������n�>�S�6��~T;��o�������8����#�
���tM�a���i��g�����s3���,S���5k�\��)cF	4��.�
}9����q������#��O�$u���}�����fN^�U�D���S���]6��b1Og/:n�P�����H������{%��������
�Uw��i`�����GCb|?i|�x���^'�`��������}",�8��e�����O�"��@2����V9e���S�k��icF&O���M��z��|��f����}2g�X�F�����n��=�����,�k'N��L���l����n�������_�=��;.�3g��L������r�0�j��!����Q}��
�w�{�z�Y�E3��}7���>5�WI�$)�.^�k�����CP�t����Kj�Z�a�:�7�j�V�/�(G��5u���	�7y�}��w��wLKt�a������8q�9�p����yw���!?����� ixO,�Xf�*���-8��u;�k���W������:����'w�n���Y?��H%��[mFa�r��Uk�^���G�W��q*+=���P��Z�����s�.��h��a�����!�N�Z����1e"<�eJ�����p��7nl����y?(wo�l���:�Y���/q�6s���wY��y����J�����>]�t^[�R�{�)3f4�_����ec�+W�8th����_�k�����p!�8Mg��5����r�����S'I�X5V�5���K��[�P��)N������C����[^)7d��7b��S�6����		��y�3�X�4�9I	���9p�9��a��5��
�4��D�8AZ��@�C�o��A�GOr���*8�D(�Y��"v��9��^��z1�w�P��a�y��S�fcM������*�?���S������D����J���H�������;�S;���#UJ����d��g�pM�7��B����C�������d�V,c<|���WZ�J��&��1[C?~��\��:U�y�>m�/�}���
����5��
������:O������i���s�������Gg��:q��s�^R��r���w���l���^��&ii����o����+��;ueH�p���2�C��&;}��/��o�N1�����"��x�-������G�>�X	���y��4���������wF3`Be���S���6H�2�|>g�O��?|�VS��6��#%���8;,^�����F�d{Eg���� ���/_�J����,���4�_��H�0~��	5�$��� v��5"U�1�������q���������/B;HdM$��>r�d�/�yE�����������
Es����]��].���3��s�wsd����^�~�k�i���B[��	���H���|��B9uu��K����J��i��:�j�J�	R�lYH$�����H��'�Wi���b0�=s[$D���>����u�k�H	������!��q5�b7�����h�3'���!�}�f��p�����A2�;9�f��>]�M���'�����X*=]��/v��|�o���_��hc�W�Y�����C��qU�Pi�������������40�L��#�����7k�Xs����5������[�s�4�`���6~���G������X�f�`My���������7�"Q	X���'L�/G�iy���HTq�~��3i���
��������t<|Z��e��U���I��l��
�;<�P|�N��A9�(m���i��g�^�j5�Y�8��q�����{
<�|�� �`�O�6n��7de���8W<�
�-������U��&Yt��u�����F�6��m���ue=�,�0C����
O51 �?��t�Ne���O�e��=��]�4Q�W���S�A�K��r���3�����K����
b�����j���b�����(�K���/0���|�
C�,
�%8�mIA :!�!d	�
�!���rDf�o�� ��;h�f�������)�"�(sX��R9�������W��^�zu���[��M�T���S�0~��[���������h|����y�����=�u�V�:��D[7�F3�����^���������������4YR��2V,������������	,�y�N��%�2��b4F�F��R�
����mZ@�z
��D�]l�K��K�����g���������3�.`��"ErC���{Yo��,?�}���Xg�R)�f�U��5v����I�+y-]a��o����2����Y�>8�9��0��M��y���������V�����!|8al*]/�)��{����'����+V���.�U�y��#o�Ll4����p����fi��M[`�Jb����W��9s���ol\iUz�T��{VE������������m��I�
�w�J�WDc��������4���S��x�/Zd���'O�~)_>��w�wA��Cz�9���N�>j�8CL��`��$���!����P��e$W���z6�x�$l�T�"`��z�O���������}��8��x�?uV�����77y�!��`g���-^��G�AO�J�lIhX!s����/\������~���K���.�>m�7�[,Hg��%K9�bI_��u&L��f��<9s����iqs-�g���U��f��;�9�iP��EKqYA���I��c�����=<m��;�!]���;|���i���)<�[7�x��{��[g���~��������>�b�
}�A�D�����g�Au�Q���$zk�_���k [O(���c;�!��q����_~�}=b�����z���7���%���)����8�����sMF���6-��8au���T�����lg��>=�O�:�y�v="���W],|����������
��'K�#��Z,�0��u�r��	��w7r��������x��KV�|9�1#���{����4���X�T��m^��*]�"�i��i3.\��u�)}�!�����uJ�*Yb��iY�fN�wP/���|���s���K�����pqW���}�>�X�(��\!&��@TA@�ahT�9�������^|t���m�S:62���Y���cX���>�y��+U��G���Y���r���f�����g��'b1'��w���$S��u�~-���t����;���a+.�A@����{[���~b��^>T�og������~^�X�	!�w!��V�L@���?8V1?g�,B&�7lPO���H��GwT��B����H�� ����9��
�!�s�9"C��>>o�� �`/�����a�!��K �
�2���u��]b� ��;��  �9qx�
Bv`�JeM�{;<�KG
���������Q.X  7Up$K�9����%�9�%�A@A@")&N�>�I�E�
7�:��7�D� :���]����BWR�A@���qb�G����$K��/�D��J��7l@����m��	�� 1'������@@@`��?�Yl;��"�"e
>���RNA���h�Y\�y;W.'^�Y(Hk��r�bHG��H;A@�/0�����7��pF���kE��Ck�\��"��*x���,�2DP�R�  �#'�#]���������+��f��!�P��>�Y�3f�t���,�^|x<�5P�#�@� `��S��"D�2�
$.y���Xq��.�D4Y�f�'���G��I?^��	���#�����O�:�����OG�&������ I��)R�x�Xq	������1C���N�>}�����o=
���h���4A@�Y3���1r��5_�F-�CA B �8o��Z�T&�@TF�������Q�3�vA@A@o  ��(�A@A@����p���{b�  ��  ��70�{C���/�;N���}c�bI��*�/{B�A@B��su?sA�,-�! ��#�"U�����S�2I�A@���g�����b����O�ION�	z��,WN���d����b�  �� �
pu��'00P|������'vP���q|!�����BA@A �������x�=p��m����%y�"�  ��  D[�~�����q�����<}��Yp0�;V�8qb�m��q���)�w���H�AV�1kBl��	��  �����a	~���/0��s�y0�g���OY��(a�D	�Eff,��ph�2��{f��DEHA@�><�c����!�{���'B���,C8����#�8B�������J��������D�����z�RA@A R!�8��o�cQd:����>z��)��@�HK��;����6�������%l�~�@��U*�������d���'N�F�<��/����&M�O�l��_��`})��^�N��������������'��o:p������.[�,%��Y�Z�D�<�]�
��  1
���?�H��4i�8qbo5�����Q��M�l�FEh#(�U�nS��-mJ"�<��a�*���L�8Qx�O�1����$f4<M�w���-����SE�_�����}��Y�����E?�H���zR���7wn���f�����6��n���s���V�J�:�����'�$��02��' IDAT�e���s��W���aVh� 7�������N]�2��Wv6h��m���r%�-�[����i����5��9HZ�����L�����B����9
�����y��Y��~��qCl������e��Q�����fK)BAsz�R�m}������w��!��M=��JOr�C�-����;p�7�T�V��o7��7��O�Z�h1>]������F�8�;|-&+l��X�b�u�z����5K��m[�I�Zk��[�!�d%N���u��~?k�o��2��~Y���'� 7����0a�Q�FY���j�w�W�^=U�Ta��n��y�������j����:���5��ZK����;HS�E���~K�T��Ah�:�����G��f9r�[�E���7��I���m��U��!T�S�}��.��:?'�v��;v�W����������,=\o7m��
���'�
a/��
�X�XT�I!P���{�[����M���_Et�"���������T�����o1_o�6���y�A�������Z��R�$��i��F�Z�9�g�����/{�����V���nz.��-W�\���oz��C
�jI�[�$i��=.7���x�v�3����Y�*h����`�
b��'
q[E��4T���*Un[mS �+���l�i� ��}��vX�~}o��~���!'����	�J[����:���w���A����)�~
<�����>vPa���?l)�r��$���^��/y������6��=x�p�0��2b��!-v��t�����uh� �N�@�i�>��|��e����U�w�_���U�^�?o��W���s��Z`������+VTb|��k���S���!C����N��l���K����t��7��(��u���C�)S�L�6��q���i�"E��Y���9S3m�~�-�Q��������,��V�^�<y�9s��bmF������2e�~Z�����c�+I���������IS�V-���oH-�E�|���[������+Z����y����������5kJ�,��+T�p��y�|�f[�i�l��i���~��B���������^��h��"���j��y�d����]���R�y�m�0O_�c :�i���&���N��yL:�ts�/���G������������B��[�d�+������l�����m������i[������h�6���^�~�'Q������=rp����3g��r� d�g�spBT�JG��~�L������Du���<���|����Nbl��G<!Vhz�o����L:��1�8�
�sOh1|�z���x�"�����&�O+E^!��N"�7m���{������/X�w�k;�s�-[��o����$��M���6m��;b�n��x��=g��5i����s[�S����>}�tx���[���@��1��m/
[�hq����o��h�N��������/�\�x�?M��%*}������.?��R���:u*D�����v��&��L04�Br��)�*U�r�
�s��4�-���wor�������-��'�9�naY�dy���7n|�����w�#n'��i�+;=zd�l����^�<|'��c�^/�p�i��q�R�Q�[�n���~�i�����A����f�l���+�TE1L�L�{ts-}�6�r:n
0��tCy��zd������v�xN�������`c���6lH� A��
��v��-�tu���.,�)�w`���+����2�pf�8JXW��\!G����yq���A$q�B�xrqpBu*����-�(��,>��TU�r�����9�		~���S����V���/�O�`����5~�H�2n�5z�=�:����-�9k����M��<le����GO
W��@���\�����ru��g�/Y�R�K
��)R���L��
��}�F���f�0O	k���[�;r�M������m��R&L��*KK/P��E�d�^�re-�)5�����qsrQY����h��RU�V�J�r���_�$��K�����|���]�V��N]�fM�����Z��[�lQ2n���j����_��rW����Nu�~|���b�4q,���N����i�6,��bL��m�+���1��/�U���O�������tZ�<�y�*U�=�=��YP��[�7�\�6X�g��1L�0<�C����b�X�[�h=���
���*�#��m{,F����R�A�yu��_Z;vlH���%v�[���-���6�Xo�W��y��������{E���9[�v�P������/��bn�5���c`qJYg�_q�o��9�;�����\��n�.���q�����,�)�&2�+�<�w����^Wr��i"���b;q�I���M
�B��?��Epj��.?r����������"]�4a�Q9u�/���jx������z�*?����!T�f����4�%Jh������k��`��q��Dpw��Eb�������Y�,�=G�����E��M/V�����6+w%�1�}e�����E���y����qz�,�Q�R��! ��Q#@C����.]r�;�4�����;��e_���@\�i�X��iEH�D�r����~t�m0���,���`�.(_����)
�L�[o�q��)��n3�.����L;��@2�4�w<C)����xY�{��X�n�����wh������k���-���6��),�6�M����O81���;j��H��;u�i��iX�j
������,Z��Xc�'&$�-N�>�����3���yf����|f��TP���Uw��vRX����2���3�"8d����.+s�wl�lg9�����W�{��K��]�x���!W��S����ze�����^#B��@�w����W{4�?��6�!��S)Q��h���fKxx����e�hf���t2t�s�rW��7�
��N�Y�K�����
bT�����/���=��&���P���NW��&�5R���N+J�$�����2��P��
���\���f`�/j���N[���0:�t5����Un7��s�1$�0����zXPr���+�W18�AI����O�u����Z��;�O~�=�]M85qw<� v������~�U4���3Pmbk�BeL��c�����������a�o��]�{����2e��9��Z�|�����qc{���:��!+��uxd����|��-�����fj]V�[��c����*2j�����_	qIF�����&k���k�l&�{��*nN��1�M;NqsY�)��/g���,}"q]�v�U"�x�+T��/��2�,npZ�lI����s��B���5����Yq���4�$�:�rW�ah�E�T�cs���X�O/S�L�>}x^���V�7�-,f���)�O���1AAA4L�EK���"e���������2���ca�EV�Su���W���������K�<����U�G����4�l�S1-��"�t}u���+L@B�9����Y����<���hq]Xk3��]U�t�D#�����`h����-�y��f����lB����������-����8q����}�5y��#zB�~~���:��=�<\&����k�<��TE��+Z�bC�y���q�����C;4o=�����sap{2���ez�-ur*\�����o3~R�>=�
�wD��	s��Dn�uj�\��/8
*@�P+6n�6"�+�Un��P����������0��'OZ��r��`bV��;��
��BLy*����%��Y�W���u��5���sT��e�C���E�^�(�T�SI��n�S��"W;90 X���;������3k1g*K����1^��`�o���<w	'2R��P;;]�@b�O����'d������n[��"ZM<:$��r<��=��0�T���X���tD30U0�"���XX5K��-u5n
=���
���*����A�4�<����D�AhQJ�e������zG���
��[?_���
O��*���qu�Re
w`W�Z5t�P���@��A"7[�ru��]�;	q�����!C��Y�3�����{������*e'� �W<A�{o4?�k����_�ZK�_n��q�y�r����V��T��?��(~��M��HZ�EB^X��]>��?|��4��
�����5k�g5��8S��a7�J={�����
�5M�}�s��7�}���eB�t1\�������D�i��%6|�n�dI7l�<�On�#�z��aS�eW5�Dv�0��#����E�aw�v
�eXT=?~<wR<�����pS�[-��q��6������#,����w�^�9U�T����4yW�B���X&l��m��4f&?�%L�5���'N���T%�f��a�Wf�����Y3V�k����7<�X���f���0�� �UK]U�C��ZDK3�c���W����A�E\�`a��
�c�t��"[�AY��D����A���5����
���*�#�<��)N��YL�XBW������
/\�BL��6|�������z,.����f�_�v�Wp�MR2�k~�H��X�*��v�������;���1��!��u9!�N�L�����7O@�c��`])94
R�Z�:�/���	/:.}YsW���x����\��5I��ry�h����;Bi��X�����b��2a0����������H�81���?U�T<��/���:������i�O��8!�X,Q�h��Y�F����!��?����v���fA�\���X*�v�u%1�^�&G>��f��$C�X��������p2��F��S���Y�����ph���yI�/hnih���7W��1���h�F���*��C��������1)����U4Q��{b6�By9����D�{(�W����=1�k{��nR\1��=	�������U`�cX�^�I�����u���Pl�y��z�I���������w	1M ��D��|�r��;�p��yJ+Fd�aSa�����?-�����>u���J^)Y�(�`�b�0�YT�f�7��������� �j�l�H8I��%^W�[�k���L��mQ� �8q���8NF��3�������nV�4��0��`zF�����J�5�#�:o����O}m������A����
�`��l�27:�����*����>}�Xi��]��Y]GA�b�����k��a�j��fx�k��'j������1�*T��c��m|E�"�U����q/�|��KH�\������C��	WK���0h^��������^7��T<p8f����|����-���-��*4L�1�^���*��i�Ro
���[fG=�4�e��%�X��%���9�u��O���5������2y��w�)[������m������	WFKz8!�������V�S��VA@�[������;�k�?�{���[���+�������	��b�_�Hz>���������  �� 1<
�l���+o1��N�R���@�"��.�f��Y���+D���;�tb��,�A@����
�,��8��P^Gx�� �� ��.$��0���v�]&<���>:�������8��q�y��V�vA@A@�<���k���&��4��,*���D�+us�<-�zg���D�  ��  D0,_{`��h�C�N:�K����(����Kb��C�JA@b8����=}���Hb8�|��rU�e���1�$�'��� [�A@A@0!�N��s�_��	��NN�����?�V�A@A �" ���j�����  ��  �B@8���=��  ��  Q��Q���nA@A@o! ��[H�A@A@����p���sb�  ��  ���N�-$E�  ��  �@TE@8qT�9�[A@A�['���GA@A �" �8����-��  �� �-���Ksw���rq��X[ccYp�gY+Uz��J��+x����G�����#g�EA@�x��-.�{����O��i�9�-�~�%����Mhq����*��,,8�:)(��  DKb�l�I�,�U��^��6}�P�S��{�/0yr�����iS�9R���4���9�'+�-T:m
�i��	���� ���mHy)_>�z"��f�!,�q���3�E�A@"�[���9����q~�����t���������V"E	X��c����T�_��j����}:��q�"����v��-"m���5v��6~���U���)l�(�:t���Z���[���^*�p��N�1����BA@A@�<����.l���RE-@�J�!�^�_L'�P����!��%��������]�l��A)R���U��[l;G��Us����a(�RN�xL��#81y�d�&Nz��Y����h������  ��  �A��xb��QG���TMPa�\�<���������qb��_�\9:�m������V�T��'O�L�6}������.P�s��3dP:/_���m�S��d������.L:���u��Y�
�,^�d��7o&I��f�j�Z4���d�.��+����n��M]:v,V����;w�~7n��}}}��.��Mkx�*[�L�?�C���)Tp��G���*U��M�<��_�/I�"��V�e���j�8�N>s����Sf��!_��C��q5��/Z����x���z�P��*}�v������V��uZ��-[&N�����HN����9?�4����2�����;we���0�an���p�Y��i
�1K�,~������<���]k5��6AA@A��x�'f]�����M��pa�f?9�������v����.P�����/_�>q��K��������������W|���������]���w�PK�T�F���UcG|�e����.����g�g�h��q��k
G�~����9w����~��oul�����d�Z�j�~�e������Y�n�Q����&&8��S���r�l���B��S�/\�8~��Q�Y�z�O����^
IsYCC�����y�)������R�x���._�~�=�d��e�����x��b�f�F��p�Y��i��n�����3&Ol���/�
`sIA@��@�#N�A��&�}80
���c]����R��H�.-Z�?xp���-���e���S���e�O/\�|��YUg�7�`-]������A�ti��5�W��93��������{��mP��T)S��R�W���q��]};._�r���/��I�4i�����n����7o�V2����N���K�~?r�]�����o���?�7��N`b������������'N=|�(a��_~�f�j���>}��F���d�����o����?>�����g������_�dIN�l��Zo��t��Z�h��:qB����fK����a���2g�l��"�"��  ���G���� ��_
��Xl���xwG�B��Z{g�
�
$�'Kv��UN�}�E+�0A�[w���ql7�1�� 
�y��7o�2���s���f&�?�?K�,�@����y���9y��8���"�����>���%�c;�7n(*�6M��3��b*H��5=�O�Ll��A��%�yr��k���C��+W�O>lZ��rv��T�}��Yo��~]����.S���}R$KV�`������8���v�����2e�S��s�5�}����K���%�!�V��Y�#M�T�l�����  �� Nx�������cXy����-TX���W���ap������;�g�� �
~N��r�P�v���r����^���{�k�^�
(_�L�X��/\���M6qL�.�����c}���U�K�N��y��H??���(Z�^���� �'N�	Lb�����!�c�j�����5���]�4q������\�H�re�(�	X�R�dI�I�,i�R���J�6M���b^�3GU����v��E�&J����+N�������._���\�|�b�
`WM�tA@A@Q��� IDAT�:�N�w�d��/mqg���,M+�W1��9�m����A����9{n��I?�YK��F<��+Vd�[�����7#��X����'OA^��Xq��M8� ?"����
!�w����?��o���KW�D��]���n���c'Nz�l�$�+!��P��b9���g:�����"����t��?W8��$NW�
jv����x���H��N����B}Y�&�i�����k/f/�jAC�"�?y�f���%K��T��s�/T��te�E�N����S�$Z��P�5���g/Z��w��J����  �����O�5Y����u�@L�a�b�/�i)��N�:u�B�N��������YsZu�t��=��%��V���1G�7��=�}'�d�8r�`�/������L�"y�$I+W��w�?��N
��g���W��G����G���)!���{�o��i�A}{>�n�F�;��;��</��Sy�Do��x�2�i��1���x�7#���R��#�u
u@`���3X��+V�����0A���j����_��'M�i-����*t���<�s��L���*U���9\���^�to�lQ��6������]
`��%��  �E�w���%����vm{��
b��`��m;q������G-�}�v���}0�l��f�BU02��^lM��z��Be���  ��W8��=�(vB���|�����v����6D*%��V�7o��8m�k�:�*���3n�-(8�1�A@�7^���`���I�o����K�u�}��m��y��h�����`z]�����K�A@�������:��������+��?��Q�1��������}��"���<���^i�(A@��B<��F�A@A@A "�~<qDZ/u	��  ��  ^G�;��^7K
��  ��  ��p��Z*A@A@��'��#f	��  ��  D��#j�HA@A �" �8�v��%��  �� a'�0��"A@A@�H��p�H�1b�  ��  �@�! �8����A@A@")�o;9�;�Z*f	��  ��  ^B N��zMFN\�bu/U$jA@A@��C����+;��a���N��N$A@A@�'���g�J�A@A@�# ��>V")��  �� =N=�UZ%��  �� `����IA@A@����p�����*A@A@X�b���AIdA@A@��������^�����  ��  n�Sa��X8�[<E@A@A �!`&��}�����b�sA@A@���7�Y%���
�A@A@�	'�	�,mA@A@�B@8�:�'D<xP�D	__�2xbs��mQ���_y�'��N�0!~��X8s�����C�s��I�4��)S����W�\9e������P����y��%KC�5���m[�L�������X�+US�NM�0!��7� ���O����>rU���{��,Y���Q�F��H������M������1C<G@8�������;���&M��c�N��'N��+����W�<y����7c���������#��W_}�y�={��\I�jh��5\$\��\���[=z�y�fT=}��a�����7�6������{/_�|Ne*U�T�zu�Y����y����;�|���7n����Ns�&�-[�n��N�"O��
n���o���c�X"" k�<P�Gs.\��m��Y/�����GUk��6k�L���{��=��7�`M��o��g�d�Fst��<|�?��S����� �"�.��~��e����?$��p��YN�-:m�4���?�p��8�����o�����W��)	m��$^0����\)aR4b��O>�$[�l�d$]�	��Zk.^��Y@��fL$Ep�@�9$H���3g�j�H��"E
c;w�t�%|�c��������Q���?|�����K_1q0~�	���_�/�B�5k��!���&�#�24���x��u��9����6�U�'���������qU�����{��W�.�
�����lx�=�@���_��b����%R)����na���M�p<�<������04�2�T��N�:5���}���%K���V�P����J����K�,I�&�������J�x���@���z+((�t��������x1�A�R�Y��<����������j���v�z���&�~�-e/]����s����k�>y��R�*]_���$�@�-��
U]Z�R�J�d�ck��cG�\� @�8q�0���T����������������w�4 ���w�}�������j/���M�� ����
�����r`i��	)�F��:�w:`�"?��3�����L�U�sW@/��/����I]�Z���;Gn�����;v,X� �U���O�<��J�.�%�u>|��hPa�c���7.?i�9q��H���~�
aZA�A���_~�^�:�Is��%�F��0�f
Z�@�#s$��������0�3a�Q��������;�Pa�"�3f��x�4i
�!X�|�����_R�P5�1O����z�A������E�\TJ�9�7PM�+W���?~.j����sA@;�wn�v����('�@G@-�(�J�-r�����������J�tVGA�8����^
��e�������B�,Ht��:?�
���u�x:B�n��M�*��t��q.��<m� �87�������\��9U�knU��c�(H�(���!a���P����v�B4W���<W����93b��y���H�l����K_�X�����U:1�����_�cZ,�@g����8�Y�&����!���PZ���uJ�e���K3��w��5XC_�Jw5`�G�����U�Vq���/�S�lF/�N��FBxi#�*.���6��I�����/�"B���g�~�O��A��L�T��[
�6�,��T�R����O����?���1�c���������?���#��[�k���V]A��I���,�L�3<V�\i1�\�F;�����P������%����{�����$�q����t��f2���}��Ak�OK!��d�G��K�~�������\��s��W��W�L8m�>�����X���� �����!C�X���%�.��B�����~��N�Wr���1��jK�Y���+�(W������O�34���{wE�(�'��)On��z�_b�������W^�[(Qf�<�t��4�hW�p��B��"E�����|�U��
�4���k����vt�o��4�rh��2��5U8���U�n��E�W%K���m���
���K)�����z��[�8��0T���v���3=�V��9sF/� dLB�IT�J�H�e��Z�o�e(�������;��a�pDf&�A6of��3IF)�z����������\��������1`����Sx���x�'O�����"���[^i���e��Cv?��3\��iBb��i���^{��+�	�e�L���$�`���0# �8��I���n!�NDy�j9��!:<�YX�JF���j��BH��������W)J@�T�j_��K4N�)�����W���"��'OW�V��1l@E_�m�%�����kX�hh��M���3W����$���!�P��A���b���#',�UdE�����`�������F�-6?!g�6��\�<`0cF-��.eg��A�(0J
���L@@>i�]��g��M�y@��T�
Rpr[[n�kS�2~��� Ot���A�����fm�����+2�pX8}dg\ZJ$	���t��"�bW4�Vm6b��<JX��9����H)N������g���.O(8�����f�$E������k��H�~,����k��j�
w�����1�������d���]�MC�Z�S���B^�Opj��M����������@F^:���%������aNW)�6C.Ms����-!�M?�]<s<��*"��N���BnP��q�H�)���+.hQ��,8��Tf�e���b]���QC������0V�<�H�����6��'O����/`�MO �y���pe^,0�z7T�t��zU�:u���9o�7�|��X���d�X��g�D�	�w�Z�>A�!�����(d��{�����3����  �E@��n!A�_@�XGE�Z/�"ta6,������e4-M1?Y�6p	� zlW��y'���V�c�
��'~�G}A\�8e���De�Z'�o��L�"�U��8
�V��~�����&vtR��N@������s�	��bFU`�q1jB��J�9`@O��*T�������e�����Y���I����-��2��w��	nF!�Z�����9����|�*�u{����p>�PU��nB;x��(4�gE�W�^���5hFRRA �'3tR0F#1�]*l��7��:��zWPI��,|�j[.�N���+7-U����&�P�lW]�>f�c�59r�'��,��>�f����"�;��MK�f��%B��p�3W��6�p��b�h�j=�XO�u�q#����hf��r	2���3[L0I��xBa6�q����VY��?�\x/ag����"�����EN�^F�[�,KE&�11���%�����fJ�V�^�'s�$C��A��\^n��y�K*���LN��w)�mvf`$��	a�M��\)tv�kv���r.�*��6�P��2D%a�
�g��Pd���j*
��a�q�������/�xY��T��
d7���TS�@��j9^�j�	��yI�rm4����@�dU����V�x��!�����QB�"����hk�I���E/�yE��M<&�gjq�#�nB������bL��E�"����jV�$�6�
"P:y����@)�YL'`���4e����[�%p��m\�����W@���!�p��?�����\F��t���nl����cy�����sx{���JQL�{�GOm �4��SM!�����g�/�I������#�Z�N�)<�`b4���y���/W@�NI_���S��?DTk��1�J2��C'�b}!e	�gC�$T@��c��F��ri��m!k��AmY�dv����E+(�,����TD-�Y����h #C�ur��i�8;��Hn���L����r-�] ��7���������^�rP
!��QA0&�mS>���e�BO���zW�N�j����9�s����D�9�~,Z-?����'�N���K�s���q`�6�\��_A@��@�7	�?�[��\tFc�t��&T����hH������������K��'A@"mGj\�vv��8������c��F\�nw���M��H��p�H�1b�  DK��/��Q�^����e��QaF�����"4��A��.�z��  �B@�bs����� �}�^�0bb[
�/�~M�1z!@;K3	g�������W[�5����p��w�Ub&�T���K����2�sq)(n��	���  ��  �@4G@8q4�`i�  ��  ��[���HA@A@�9���yK�A@A@�" ��-D" ��  �� �N�;X�-�;=|�����D��X>{���#I{�5k�yG���*��B�,T���b��L.����3gzQm�T��a���
�1�z3_EVU����v��V�f]�9�S�N���@:n����1���iHG��R� �5'�t��������S���rC)�e�y{n>���0Y����K�&��}�e���f��MI>	������u�d���'�Z����@��y������5;Y�d_}����
6��uk��}v[�re��eg�F$	9��sn5�a���N���r>���9��W�\q�-l��[�f���,_F��y���r��Y388��p��+U�T�zu���C�n��a�k���:t(���e�d0�|��*�i�����2�F�f]��5o�<{��f
�O������3��F�N���~�Y�n]�|�����W�E����5[�|9����cf8}��?/^�|��m��r�7�&D���[!���Z|�I�j����:.�����.��GZ�jN\-�u����
�����
�^�v�z��[�?�!}mlf��Y�|����+���Fy��(~��M����{����i,#��&g��I� �RN�o��1g��!C�|��v��W����$��r���5n��mq��`���e�����o���sk�W������o��S����|���jl��9<8�����~{��������_�u�n���ql<����k
�]���W��:Ca=�+�g�n�:����g�1u�}����54��i����2�s#~H��M$�"��v�&U�"6���K���I��'�n�I�W�wz��[
1D��u����Js�q@��/n;�2���q�l�oT2m���b����-�PsbC4��*����q��7_n��%RDox4v��g����:k��c���+W>����un��y
j��6A��ca����yS�qbj���Tt����H�={�N���x�k������:M'^���;W�\�f-����7��7����g���);vl���`]�M�#F,T����K%K��6����M�4�"'����
�\A ���>Y�zE��>�����r�����v{��NqO91u�M�����/�>c�E]:�g�������!���]��o�5z��?���l������Xl�*���w����w�����cn�i?e>�V��vj�.C������I�G��F�n�6��v�Z�r�.\���@U���S!�E�M�8q���7n�H.T���v������/'���SO�8�O���X�����P��*T@U��Y��Y��	!h��!�}.��{w�`<�HRj��I��/��0�8�6m�4f��X�b�k���u*w����U����RO�>���/����#G�Z��z�X~����U����V
&�~�m�V�z���������K�{����6�/��B���;S�L�X�*U����k�)R4H����13�:�md�(�[x�=����aZ���P��@`����0���o����
e��!�J7�-��k�=o��''NTYw������eK��SH-�b�������W(�Oz����<�/��2���HwBD�;�e��k�\��w�g��D���R��T�;v,X� ?��vM�>��B��.]ZK4k6�`�������G��K��,_�o��F�������\�ra`�
��J��� 4�������=z0���(�u�V�-�F�/0����v���!_�9RO�9q���<-{�?bz�;�i��������^������T�6\����s���&W����G�G��^��s��%��j���{GP���������_�����P�N�qQo�F8�O.d���7k�8u�a�9;o>h0a��-'�n�������L�s-�|��i1{��*k�/G|[������U�������Y{�6?����=.�g���p������/	~����mG.�5��R�>z�S��D��8���[$*�
��q~����-z��87
5PL?m���z��*�k�������i����xrC��|W�-��k�����8'V��knBy��N����r}9|���wd���H�B�?����Pe�Rp ~���,X^.���R2��Pu#P��*U�,fH���NX>���+�G�A�M�t ����;��v>��St�G!��_���cB����2t�����
~�����fX5b�%�O�/+q�*�!��|�
Q%*.B:
Q?��~Z��E��������A�&�	�]
x5�9�Q�e�e!s3�
���� IDATF�H@�*�
RWu���E��F�6=�t�����."�.��{����������V�x��9b�bf��6XEG�3.��}���g���p~�����Y�
5VW(���51W���`�Nw�(�w�su�X�B]�����^�4��KT����K��[*)���#h�~���ZH�����9��X\��wA��q���I�iw���,X��e(�#?�~�VRd������s�5j;u�c�u����k}��E���;m�/�(�Q�/����/���j�'3w�&�����h���]?�Jz�9;��A	4�����U�F��c7:��3v�J�i�:w���.�C�8��~�#�����W���R�x�9J�H])o�/j(�)�����Jb�X��r�!���VU����h�_�G������e��F���B����H��V���vE��F����'4�����s�4�tHa�t�x��W�pPYjc�G���gU��..�hO�1��7)RD�x��#����S���Hkx![X� 47�z��*����`W2Z�5x���f�6���o��8������@<��8�������?S������9j���D$j�}�u��\�l�Mr�
�����v*lHt��N�Y����
^�Rpp�2����e��
, 
U]N
PW��y�<���X��K���%�2e�� 34��W�E��^�����X0G��(���<I�*�Y�9VM7qL�6M�k��q�(��90���ZV�Y����<����b��
��p�zs�%���0O��O��ux�V*;�o��\��������q�8~��R'N�q�R�fJ�"Y����g��9��;�H��m/�,R��b�<7<���7�{;
�dI��v���^����2k���^��8��U��n���J�w��>}�a��������Kv���L�9q�U��|������(2��2� ���>���$��w����	�/�3M��)�n;���}�������D	U�3�}�p��D`G��r	��%�����r%y���u���Gy��*�����~������
@
��� E��R�C�4,�L����*�XqE�F�DX��k�x�l ��"� ������x�,7��Rp�)��C�E@5o�VJ!�O�w�A R](|��P��/�<�����o��"�\W���E���������mj�.&�D����]A���6�V$����2�q�Bg�
4����1�b����O��
�u�Y���<����f��9�3;���F���g�^W�;UH"C�������s����iS�����~���v����?����>����*�Jq��Iy��-�%�1��\��S���q���'����/�/*�5�_��73������Na��8�q�j������37?���l�������!y��
�]s�j�f�"���w��[:�Z��������Mr4�V�o^��W��,�%��,9p���Nv�1k��)qCV;=�7nH��� �c`8��l�����<�)�X|��'pGu���f�{d��4���bo�\�N
Y��B��<yN����D.�+r�B-����^M���0����[~k,�����������a���|�L`�v�&�]�j3Zx�O.��
��s���G�"K��t`�C8���3S@�si�2����5��������>��c<�L�dI+K����q������u�S�l*�~I�����K�i��Vi)��u���B�Z���i����XKV�#`�Sz������
x�-m��]��oQ��G���\���+�������������B�>�]0������z�o���^,
~�9E�ak���}��vN���tI$���Y��29���}���i�(��Y&
��*$s�{O��������[w�%w�������'O�4a��"1*���1�!h�>�c���X�zq���6*O*�$�<�+/�YRf�A_E��7��v��Jn��W�_,d����k�A�	�Aou
���rW��9��\����g��(Z���l�XG9����{��	jv�����ZWv������4�N���,!�D1K��`b��+H-��{�E���l�f���:H��tQ@��G+�'
�@D�b��" ���;!tR7�l����e[6,�����;��{�����9s��'?Ob��5�a%� �����tR>*�7n������r>�����5r��7���A��,
=���\G������#����C*���'P$<42Dw>)7�
q���J%�y�Il���������&�R�Ql�����	�-���EBO\�7Y�<�#�R]HY�Z���g�>��.��
�mb8�{�+�h���r��9�R\l�����������^�������d�>D����#��z����mS���R]�Z���m��Q	�7�`�G����X�#C^������B1�@��{{��8$lhD�bq:^��g�pSa,<
���)�lC�W<�"5����
��P����������7o���,�<!�Z���7�M�>������Xd&0����a���`��(B
6bBD���&�'$$ �)�Us(G��0���>c����(D�XW'��9�.Og�\��:K�KD�D��CMwH=��&�� 7H�#6����nc��<J�
z�;C�,k%�k"Q��|�$0x���
N_ob��! 5�����%#NH�L J
��Ay��y���{�X���5���%�A���a��kn��m4>��~/����L���/C4����l��>|�n\�09x���a��Pn�1��a&���E{�?��a��~�����f0I����Szv>"I�����Z~�N�<s���7"�D��V�]&�(���{��yk^�1����(L��AI�a��������k�H����\�>�]~h'��w�_���������C=s�f�����}8����o4d���~5�����~�!�%
�1�04��X	$�����
Q���E�(�������"���r9�'Q�0��Th��J,��3��Y?�
o(~�P
+������'C�#u.���F�,�y�lp��V��4r�Hh+Rd���i"E���+t'�0:8�e��v
�,`k�O��u#L���o��c�JA/5��P�8���U9x�`931�.��4���[�C!L.����`�04,ODd�h�K1)�&|�,�ss�\	=��@���3,X��Xd��;�2�K(�P�E/btf��!�s���)������4.���

��1X�Q�z��i�]��Z.X1��=v(t��s_8E��g,xAI�m;P��NZ�:
�v�TQ`zP�U"���9ve��iSX�XF)V�2��n!���ZC�3|DX?����[0S8�p�"�J�0�e�h���"��	�b�D2�M�6A��Kg~���Q��1:
t�>8��t����3�y�<�q�
��g8R���~a��j�o}��xw��q$����C	~��Y&e��2������/r�!
�=�j���#1��5�=���hK�BR����{��P�I�:]�D�>Ca*���O�Q�C���a������Y0b�.d���#)Y������>[y0������o6�/��8z)I'� /[R���w05{MYw�j:2�!w,Ld3�SU�P���6���7��c��u��/J���@�|�S����I�����[��#��w�{�=m�h�!�"[��?j�_f�������$@$@y�g��O�ko�X�Y�){����y/�z���$���zo|��t����s�9q��jxy����V��cr��{h�C~D���/��h�T�S����<D$p���yW�q^����:7�Ra���n��� �|�������B���=[H�!6�6q�jSx�,<���t�z�K6�=W�Q$�g:���p�]��S���������������7�_:2�
�B\c�
��H�?-�H?��|�>����13g���Mz;�9dl�bv��
��\���������p��H�H��6�'��f���	�	�	�	�B� ����B�mH�H�H�H��%������XH�H�H�H�|!@��jlC$@$@$@$p/�M|/�&�B$@$@$@$����Pc    �{�m�{i69    _�&����	�	�	�	�Kh�K����	�	�	�	�B�6�/���H�H�H�H�^"@��^�M��H�H�H�H�j/M�6����F$@$@$@$@�D 66�}���\��6q���5jt���@    �����;t�p�u�$@$@$@$@$PO\T)�H�H�H�H���&�����$@$@$@$@�A�6qaP�L    "@���f���	�	�	�	���A�2I�H�H�H���mb�-�J$@$@$@$PhU�$   �'���i��+	�	�	�	�@a�M\T)�H�H�H�H���&�����$@$@$@$@�A�6qaP�L    "@���f���	�	�	�	���A�2I�H�H�H���mb�-�J$@$@$@$PhU�$   �'���i��+	�	�	�	�@a�M\T)�H�H�H�H���&�����$@$@$@$@�A�6qaP�L    "@���f���	�	�	�	���A�2I�H�H�H���mb�-�J$@$@$@$PhU�$   �'���i��+	�	�	�	�@a�M\T)�H�H�H�H���&�����$@$@$@$@�A�[�8k���UJzR��_���7)g��������F$��LV/{�����2s��K~���5����d-��?d���|�/J2g����CH}��_(�RI��I��e-�X>j:�9mt��~1I�h�s�w������&N���_q!0'+��D��a.*�����S��EKj<�v�a��E�/D��
�Z\V�Ph�LI���#�5��C�����-u# �U���u��96^���*������B�}������$������"�[c�������/s�v�>��+��N��s]�w��o���,-��I������-�.{��CF���B���������:
��5#���(}�[O�u�/N�T��j���Rc]6�b�����\�����C8B����!?*t8��Hs�J$@$P���7����_���hu��\h����ZU����s�`�����5YT00����^�u������+`�zp���25�{�'
sv�	��z]45�������S��{�k>w �
����� U��A�*�K��
���)�N�5=Ir���]��	�	���O�5U�������D�
</@���?��<�JU������(�.
��5��7���d�qnV0�C���,I�b_�	�vT�;�-�/d�9!/N�5Z�����#u������]]��}{[:�B�z�/�uwGYN$@$�w�g"��",&��o:�Ph�v�K,����*��K	������q0l����k���t��m�,�\�_��,�8��?�2� ��+��:�����mV������8@���S��F�l_`I���+���>7Q]���������3��XL��O������d(������+����2����~^���[?������4t�*Y%��?��������
�u��>"���P��{Y���@[@�q��RM����C���1^o5����6{*���T�E��?��5%��ZU���������.{7�_/�%�"�D�C�~
��5�)�������]U�F����8Ed	�^2g�^9Y*���:�~���1
���6}"l�l���m�'����O��-(�����>Mgve/�����8��������Pt�2��"P>b%�Z3�
Ul���[�,R>m�C��N�����5�Z8&���r�(Ds�1�S����O�I�q~^���,�m�x����;@T6�?�6����nkN��R#�]]�~����.�\�����������YN��4�4�]n�|J�K��Hm�r{I:�����}+��leTikF�s����/�3
>�S�Z���|�,�����M��Nl�25�Z����"�Xn�u�����|��"4Z� �tb���wM'�[�&<S
yv�:�	����0P�c��p��>��x��I���j�M�a���g�@p~|�C�������q�`��`�t��)a�U���4��k�G�!���B5��@U�j�����R,N��g�t����(����?��i��m��*��J��&R/{��/g�9c6a�4���>?�����K�qgih���z]������"�6)�J:��G  ���-v��S���s�Z���h���@Y�r���J�7~��}Q����gN���M��]h1r�h����|%��c�p8�����'�����\����dRc3�S?h�����b��\���$LX����3Z��'kk���U���Z*��3�A����'����]_��p��x0eD�����P����7��r�|��0�#?�RH1�A<����/b~���
C-ud�����{���z�����3~xM�6S������1r�v������%d�D��/�����5���l-KJ���\��0���wLu�f1�S�v6l�1u�����K��_��HKJ���;�Q����e����nTekE��!DI��6��O1}(��e��?��_F,jF~==E]��d������`jH�������/����� �Vn�p��+�"�Y��	�-WOg-�D���7�*���nV��n:�>mlk�%��G���ce�����I���tN���������0qS�:�U���P&zrb�'��Q���0�t������|nL������}�w�M�q�
��OD5��d|����?G������q�~��x`�����oI�7�����H��{6�U����:r�g������������Q���f�����[;�����'p]HO�����m�����q'sRB������� 6_:�b�S��U�,R.r��m�-�Q�b,?���MeD���q�����Y�%Jyh�/��3��u1���13�B�|e:�%@��b�l}�����u�!�A,��/	�	�B���V��S������P����[`�,ZNY��g�M��xj�}/��-a��#,*xb���/kP�m���G�������Nh��������������uz=�i����~n�9�><�0���m��M��}��_�7�����+�<@e��������p���2��?��
������5���@p EuC�u3��W�#9��0�T���L�K��������o0�`f?1V]��s5��]jzMz��[���1��\Y�u
�Y�p������j�*���,�r���	9�������]��P�"p(�E��u3���q81\��
5A��~ ����`<�����H9eLY<@�i���wg��0����H7m�����Z�v���b4l�	�;v���4C�F����m��8��{0���!�X�z[~	�HX��C����Ha��,\)�������NN�����I����pZ�/{c��4�^������|"j���o�=@����u�-������W�������r����I��1������G�;��_������$e`�j��BF��!�u�	n����6xXb�T6��*S%�N55��@�I��>������oqV�%$@$@$��M�_���H�^**�,�Sn��)}�d�����]5�r8&�o|�:�q���Q4�Ji�d��h�ul%�3Y����
��K�i��,�2��xVk�5D@�8���$h���|��S����dJ�E}i�"��,J��x0�����C���(�������)��4�����:	��WF�������.���%Z���2�!`�������^��Cg��u\~���^r@�7��-��)�"��/,fk�e�������^aF #�d?�e� IDAT}>2�1���r(���0LV�M0\�g�m��P9&!��6��
��xo(Z��S���v�M[�Y�|� ,;P�V�J����*���	cTG���*K�6x�q��P�����g��J�.d������Y��#&4wy��<��Yz^!e���Z���G~N�R��\4�_��U&�����<��5��QlO9�UoX�
E���]P����	�a���v/��2  ��P� @^���kk����������b��`��1� z/�������C�T{5,i�g�9��YU�8�D	2+K�����m�A�,^qH�4)K��[������|vO��S�:����A,�T��^|�4(�O�,By8�l�,��H����G��R�l��������_bB	�+B�M�c	D�s���M
87P�:���.� o4ba�*���Yp�!���y���l������
v������*W�C}�CB��*��x���v�s+�����(�k9l�0_�:�b��[�ro �(��<��1Z��"������V����H��I��K'�[��]�g�$^h�|��ynH��wr���P��.�i��������W�<���I~_dw�`-����&F�*.�Up�U�Bbi\�X�����x�H�H�G>��J���4)9����8�]b��b&xp#Go�sdG��k��o?J�[���X$	�uF�W?�7w![�cw�d-!"�sV�������=��w1SO��1/2�
8��|�*:���J]�t�bu�?���
�q�Yl����8�@��(������Y�n�a��x��5�76q�d��&��@\o�W���J�������>87���,���2D>`
�q����R^)T���jI����q{a��E-������q�����S}�����,�f����^�K�b������]-�3db��8'3���xbD�8�qw!;�ih(N6/��Z ���~F���AFb��^���sP���@����]���*���VQ(����-<BI�����=}��w�-�H�H�	�;a/C����KV�'=�G�-6,��ia���C>,�O�R�J<����d�L��x���Y"l�Q��|���E�S����i ���l��w��v��v��m��9��aC��\�:�:��;w�e��������d[p���x���+���7/(Tj[��8�t��8*E���o�����X�5��d��rv�;M
�k[/�
���:�M������sv��S�x��v�E��q�R#��_<�HY�n���Q���.�"����=;w�����CG����%�������Q8��	c�cpS�Vk���5U��
�
�X�d).tw!KA�������l���3�^8<��z���X���au�f8�|���
��;p�=~q��p9$�B8�������!��4��� ��XH$@$��@Amb!v��c?{�O���?HK���E������x��1����)�W%&��8�\=���!����i_��ka� w�Ha��-"SUe����?E�!�mMG7�N��D�Z�8���H����#F*'������
l�>"�O,8����Gm��R���=���	��*<��-s�<��pT����a������O�_y�{�v's��Dx��cD�x��fc`��+a���TW�r]a�����R�]Fr�HW'lk]��rf�Y���h�tT���V�@����$���sM'w�9�X���dR ���)�P���TWo�,��"���N���iM�-\^��C��@����,���\�y�p���G���������-}����p
���-%}��ms�s���G�=�`�#�k��w{!k���9{��)�����NN��,J.����_�vg��&�b��������@��)��8+ �-V7"��\���Cb��5p~b����s����) .d|_�A�i��.$N�,�GI�H�|&�z���%�H��]LL��$f��I���=XZ�
3��H�m|EHZd�r)#4U���D�&	����RS��"@a<�VP�WD2`�&��)�a������B)�$���Yx�2xE��5_KPW�o:�=%g3�C�W���e�|]��L	��vN ��������<��x@S������e_��9���'�����IM��b�����S-�����������h��X���J�����~��.d_�W���aT�������f��Y�Z"X�����WtR�)#lxX�������9k���I��ff-�<�:���x�CU2N]�.�/�?����e�R������4V�����js�/���|"R�"��l)��F����\mm���4���T-��@�<\�hClt�%�����xV�\���lL�����N��s���Q-@)��eL{	�����dg�,&
'\�UF�������P�f���ek#���i��M�����=�N�Da��l�k�|���'�%���ib�)4:<��X2��@*.�h�1:��>����O����+g��a9.���&eJ��u�i��9�4�����wd���@
j�R@a���9N�����(��m���9[~�(����SBJ�a�1����X��l����
�"~���W�J9���R#?	l��ep\R�c����nX����2�&��X�]���
��*%k���)�[���"�t���.��������$tH��P!�0V��Ew�S�._m�'������e��F����@m���nB�YK�c��25�^��0'�S(�V;wW.j��=8��T�:��9=�)���pWB����	���!�--�W J��o%����I�������9-9���	�	�'`0�X���z����6�"~���Mr�a�k�Fy�]{����A��a��������(�ax��v��Ig]�[����H�H ���r�$x������6������c�!�;O�l�7]R�|�<w^%j@n���������b���,& �7_�N��6 ���QeL�1b�P#kD`C)��	�������bp#T:j���SIjE$@�����Tr y�K�^|}H5��{c�C8{��Y�n#�X�i�b���s�B���3�" ��"����Y���9P�M�w��_������$@$��O���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	���M���G�I�H�H�H�
N�6q�R	�	�	�	��P{������Ywt����%#��Y�V��|6)��'�jP^�c_�{����jUJE����#u�W.�R����o���k�2������(4[����S��9
����h�d����~7
}>4l��M'�n��g	lH$@$@$@$�w����T-��M<�{��u��q��~�~�'����Q�s��(���H����z�LT�}���u����U�/�&���5��z&)c�����NY��a��.�sNQ\�p}�9_�Y�H�H�H�H��	(v�al��"�2��q��U�u��W.�`�p��3���V��o3�F�|���^��yY3�j���fo�������'���H�H�H�H��%���]�9�X�}y�r��N�����i���W�d�
��3��}���2&=��c���C�/����q�����o���t_��T=��s^l�TH������uGJ��l1�i�6}}���������T�T�
E�/�u�BJ��^B�Ik���q�xx�7�{���f��?z)m�o�#u�S��V+1��}�k�	�	�	�	�!����-?��wj�K��R"��]���<`�v�-���8f]�������������/��;�Q�e���v�Q�]
�u�7��|���^:�-,����o�^�ZkD6���Q�_�����,������o3��������������R������od+    ��O �~�w��r�a(z�J���b�i���#C;�,�sW!_�'����l%���W�&��;9e�B�nU�x�N�	T���u�,��\�][Q>e���5K	��#L���J}�����F����z����Vk�����,�GI�H�H�H������5v#��u7��G=|��`��5v&���_����e9,Tx�q�:�(%��S&�e}��1���w`�����.87��l[���Yw�r�f������7[g�,!   �
|����06&D��:l�7��q&i��-#~@�R�k���w�
�����j9D?�����h{|twc�_q�����pn$@$@$@$@~@�w��F��� ��r_�>|�|�����x-���_����b���#�<p!����V�X��)�BlX�W����
T�P$���o��r���y�k�	�	�	�	�A���Bi,_�|c��#��������5K�8ta�A�����
j_��P�����t�.�h��9xd�3�I����
36�\���d���@��l�= V�!���l����p<�ad����@e,.T��&���H�H�H�H��$�m�+�!>[yC�������]jk��������	��l����4�8��f����>EXn�;���D�n���=�����]	I0[��Y�U�7����!�D��k���@��OLZ{/��q�I�����X�6e��L�	o�h_�$z��r�1���5?�|tH�S�m�����`�#u�v�Uz������?�!���A��������<u?J��;�:����+����i����p�sW�T�H�H�H�H @�eC�&-�][7��dC$@$@$@$@~D --�{mO�ko{�'V����}�&<X�����	�	�	�	���O�[�����w�`�!	�	�	�	�	�@�1&�lB$@$@$@$@~M�[?�_���	�	�	�	������y��f�r.%��#�r    %�l�:����6��3�W����V,=<����6����'�mx����-�Nk��I�H�H��"`o{6�!�����G/}����]	5KF�mx���d>������{5(/��;�[�'&T��:��,=R�y�b*{S��	^������n?���u��9��C� ������r����Zt�Y��Vj�*9�M��6�P��n��6�������/��{�e�z��!�\��^�K�u��:���x�n��]�N^�8�������O\1���K�����gQ���!����H�H�H �`
#�"O�b�������`-l����u�[V(4{�i{�N\M��^�Z�Q�����G=�wX����h���i��k�]`
�C��?�p����o�
������M��U7,_�x��C�[x������-J��$���b=����e��l�9�`L��I�������������8���:���^n���:?��G�����j�YF����^�"s�vp����_�iW\���������~��/�����E�c��a(������_��yJ�+������x�k�	�	�	���71(v�al��"��Z-��7����Y�^��/;(�M�&x���-�&>�X6�q��VU�V,��O[<�����[N�:�Z��A�������V���*
��14�Q2���=���[&Z6�Q��Ye�w�]�ay�x?��G��*�������������
�/����
b��S�RbB�0���O6��� F��W��D#���T���m��Q/N��0{�\��/��	�	�	��'P /�C������w�M{(��8�������Y�v_������W7?��� ��B��}�ST
��G��������=iY����{�C��'��9L�~�� �����s�[�0��j��'�����Ba�r1��?��P
8 �{�?[yh����������y�����k��M���&xwCW��g����Bm�- ��p���?��<���|+�������r��aw����y�36�X�Z��:|q�_�cB�S�F?R�u��c��w��Y�5[w���#���z��]���q�P����o9q%�LRf�����o��&�'��c�KG_������G h��W�p����s��>��}�����cx�w�
E����+��q�xxPrf�sT�?�E��������a��^e��-�4�}��V$@$@$@y��&�����bcc���wWb�A�N	o���Z>&���)�U**��
����e`�.����?���3?��@���k�D�@F�i�+�P���>$k���
��x�km��mG�o�n�����n8�`I������`��6CK�N���|��j�V���;�����������G.�.�t@[8>!<��_��R*��_���c�����N�=8�sm8�Q�m���_o[
��]N{��:���<E����[�9q���0��}���wH��G��&���������6�t������r������"w�hW����������9>���0
_o#���Ml�5������`�Ny��h��X�xLIT@����Nm�	��;�i�}y�RZ�*�a���y�y�K��U�����w�
2d�6�����W&
�<����_��.�ao=}u`����G�r�����{�(x��(��y����-�:�a#zLf�sT�������s�?��i���B���Z��B��?�������j�%gV�`	TEd��k-?x���q�?�RZ����U�����}   ��&����w�n��J�C����^{dh��%"<��zS'#�?�sG�0=�(i`5����V����sn"����q6���+���Z�m?��B�1:DKH�V�R��qQ8�sm�����Rj���lt8;ao�+y%={���c�a�/�N��9>�������9c�I�#��hX��!�<�������a@��s��+bUW����g��<�{5�����#N����UK�_.��`�R�c$v�MBeod��j�:1��P�=�H����	������t�i����SQNMX���&Mx�tR,`a�"����
��j�f��{}����Y�S���/W�a�	�"tGFm�I����)�N]f���U���[Oa����+��Lw��`������fI��K����M����_����c�q&c��
N5���yL�p�tF[��\���e�D����
@�N#�f^��j$@$@$@��@����;�Z��Bp������t���M�
�i���Y�����!�����)?����h�V���-�����3AQg^�YD'�RD���"g�n�������v��(�a�]�4L���p{?r_Y�D*l#Dw����+�f[�0��-rwT/�m��9>�+���Q+��%"��&�[�ZBZ:f����n="�i_]�6�t��(L�
�����7���`��?v	v!l�W�
;���%Q�_��p<���P�����l�2q
��mx��wG.|���kZB��)!�3`��������p��6��g��	&�p�$`K�%�(�����������|��1�:q����������D�\H���4�i����q��1����i�|�%$@$@$@���"~���MZ��vm�x{ze/$@$@$@$@$pg	���7���wV?�N$@$@�K��UIDAT$@$@��@���o�r��H�H�H�H�n���2�    ��	H�#������	�	�	�	2������U���IEND�B`�
#50Brar Piening
brar@gmx.de
In reply to: Alvaro Herrera (#46)
3 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On 23.03.2023 at 10:35, Alvaro Herrera wrote:

As with the <simplelist> patch, we'll need to patch the CSS used in the
website for the docs too, as that's the most important place where docs
are visited.

Ok, I've created and tested a patch for this too.

Since the need for ids is starting to grow again (ecb696527c added an id
to a varlistentry in doc/src/sgml/ref/create_subscription.sgml) I've
also amended the add-needed-ids patch once again so that the build does
not fail after applying the make_html_ids_discoverable patch.

I've also attached the (unchanged)  make_html_ids_discoverable patch for
convenience so this email now contains two patches for postgresql
(ending with .postgresql.patch) and one patch for pgweb (ending with
.pgweb.patch).

TBH I'm a bit afraid that people will immediately start complaining
about the failing docs builds after this got applied since it forces
them to add ids to all varlistenries in a variablelist if they add one,
which can be perceived as quite a burden (also committers and reviewers
will have to get used to always watch out for failing docs builds
because of this).

Since breaking the build on missing ids was an intentional decision we
can theoretically soften this by only issuing a warning or removing the
check for missing id's altogether but this would probably defeat the
purpose since it would lead to an increasing number of entries that lack
an id after a while.

Regards,

Brar

Attachments:

001-add-needed-ids_v2.postgresql.patchtext/plain; charset=UTF-8; name=001-add-needed-ids_v2.postgresql.patchDownload
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 3836d13ad3..1432c67c2a 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -252,7 +252,7 @@
    additional columns not provided by the published table.  Any such columns
    will be filled with the default value as specified in the definition of the
    target table. However, logical replication in binary format is more
-   restrictive. See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
+   restrictive. See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal>
    option</link> of <command>CREATE SUBSCRIPTION</command> for details.
   </para>
 
diff --git a/doc/src/sgml/pgwalinspect.sgml b/doc/src/sgml/pgwalinspect.sgml
index 9a0241a8d6..62d9f9eb22 100644
--- a/doc/src/sgml/pgwalinspect.sgml
+++ b/doc/src/sgml/pgwalinspect.sgml
@@ -157,7 +157,7 @@ combined_size_percentage     | 2.8634072910530795
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="pgwalinspect-funcs-pg-get-wal-block-info">
     <term>
      <function>pg_get_wal_block_info(start_lsn pg_lsn, end_lsn pg_lsn) returns setof record</function>
     </term>
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e92346edef..f0ab6a918e 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -178,7 +178,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
           <literal>origin</literal> parameter.
          </para>
          <para>
-          See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
+          See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal>
           option</link> of <command>CREATE SUBSCRIPTION</command> for details
           about copying pre-existing data in binary format.
          </para>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 9d4b9d4e33..605b11bc67 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -61,7 +61,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-subscription-name">
     <term><replaceable class="parameter">subscription_name</replaceable></term>
     <listitem>
      <para>
@@ -70,7 +70,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-connection">
     <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
     <listitem>
      <para>
@@ -81,7 +81,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-publication">
     <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]</literal></term>
     <listitem>
      <para>
@@ -90,7 +90,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-with">
     <term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -102,7 +102,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-connect">
         <term><literal>connect</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -129,7 +129,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-create-slot">
         <term><literal>create_slot</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -145,7 +145,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-enabled">
         <term><literal>enabled</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -156,7 +156,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-slot-name">
         <term><literal>slot_name</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -185,7 +185,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry id="sql-createsubscription-binary" xreflabel="binary">
+       <varlistentry id="sql-createsubscription-with-binary" xreflabel="binary">
         <term><literal>binary</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-copy-data">
         <term><literal>copy_data</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -243,7 +243,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-streaming">
         <term><literal>streaming</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -271,7 +271,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-synchronous-commit">
         <term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -303,7 +303,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-two-phase">
         <term><literal>two_phase</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -334,7 +334,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-disable-on-error">
         <term><literal>disable_on_error</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -346,7 +346,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-origin">
         <term><literal>origin</literal> (<type>string</type>)</term>
         <listitem>
          <para>
002-make_html_ids_discoverable_v4.postgresql.patchtext/plain; charset=UTF-8; name=002-make_html_ids_discoverable_v4.postgresql.patchDownload
diff --git a/doc/src/sgml/stylesheet-html-common.xsl b/doc/src/sgml/stylesheet-html-common.xsl
index 9df2782ce4..65c58ba750 100644
--- a/doc/src/sgml/stylesheet-html-common.xsl
+++ b/doc/src/sgml/stylesheet-html-common.xsl
@@ -301,4 +301,126 @@ set       toc,title
   </xsl:choose>
 </xsl:template>
 
+
+<!-- Override the standard section heading generation to add an id link -->
+<xsl:template name="section.heading">
+  <xsl:param name="section" select="."/>
+  <xsl:param name="level" select="1"/>
+  <xsl:param name="allow-anchors" select="1"/>
+  <xsl:param name="title"/>
+  <xsl:param name="class" select="'title'"/>
+   <xsl:variable name="id">
+    <xsl:choose>
+      <!-- Make sure the subtitle doesn't get the same id as the title -->
+      <xsl:when test="self::subtitle">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="."/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- if title is in an *info wrapper, get the grandparent -->
+      <xsl:when test="contains(local-name(..), 'info')">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="../.."/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select=".."/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+   <!-- HTML H level is one higher than section level -->
+  <xsl:variable name="hlevel">
+    <xsl:choose>
+      <!-- highest valid HTML H level is H6; so anything nested deeper
+           than 5 levels down just becomes H6 -->
+      <xsl:when test="$level &gt; 5">6</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$level + 1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
+    <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
+    <xsl:if test="$css.decoration != '0'">
+      <xsl:if test="$hlevel&lt;3">
+        <xsl:attribute name="style">clear: both</xsl:attribute>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="$allow-anchors != 0">
+      <xsl:call-template name="anchor">
+        <xsl:with-param name="node" select="$section"/>
+        <xsl:with-param name="conditional" select="0"/>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:copy-of select="$title"/>
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="$section"/>
+    </xsl:call-template>
+  </xsl:element>
+</xsl:template>
+
+
+<!-- Override the standard varlistentry/term generation to add an id link
+     after the last term -->
+<xsl:template match="varlistentry/term">
+  <xsl:apply-imports/>
+  <xsl:if test="position() = last()">
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="parent::varlistentry"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+
+<!-- Creates a link pointing to an id within the document -->
+<xsl:template name="pg.id.link">
+  <xsl:param name="object" select="."/>
+  <xsl:choose>
+    <xsl:when test="$object/@id or $object/@xml:id">
+      <xsl:text> </xsl:text>
+      <a>
+        <xsl:attribute name="href">
+          <xsl:text>#</xsl:text>
+          <xsl:call-template name="object.id">
+            <xsl:with-param name="object" select="$object"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="class">
+          <xsl:text>id_link</xsl:text>
+        </xsl:attribute>
+        <xsl:text>#</xsl:text>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- Only complain about varlistentries if at least one entry in
+           the list has an id -->
+      <xsl:if test="name($object) != 'varlistentry'
+                    or $object/parent::variablelist/varlistentry[@id]">
+        <xsl:message terminate="yes">
+          <xsl:text>&#10;</xsl:text>  <!-- leading newline -->
+          <xsl:text>Ids are required in order to provide the public</xsl:text>
+          <xsl:text> HTML documentation with stable URLs for &lt;</xsl:text>
+          <xsl:value-of select ="name($object)"/>
+          <xsl:text>&gt; element content; id missing at: </xsl:text>
+          <xsl:for-each select="$object/ancestor::*">
+            <xsl:text>/</xsl:text>
+            <xsl:value-of select ="name(.)"/>
+            <xsl:if test="@id|@xml:id">
+              <xsl:text>[@</xsl:text>
+              <xsl:value-of select ="name(@id|@xml:id)"/>
+              <xsl:text> = '</xsl:text>
+              <xsl:value-of select ="@id"/>
+              <xsl:text>']</xsl:text>
+            </xsl:if>
+          </xsl:for-each>
+          <xsl:text>&#10; </xsl:text>  <!-- trailing newline -->
+        </xsl:message>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index cc14efa1ca..15bcc95d41 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -169,3 +169,13 @@ acronym		{ font-style: inherit; }
     width: 75%;
   }
 }
+
+/* Links to ids of headers and definition terms */
+a.id_link {
+        color: inherit;
+        visibility: hidden;
+}
+
+*:hover > a.id_link {
+        visibility: visible;
+}
003-add-discoverable-id-style_v1.pgweb.patchtext/plain; charset=UTF-8; name=003-add-discoverable-id-style_v1.pgweb.patchDownload
diff --git a/media/css/main.css b/media/css/main.css
index 5f8bfdd5..c3464cd0 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1175,6 +1175,16 @@ code,
   padding-right: 2em;
 }
 
+/** Links to ids of headers and definition terms */
+#docContent a.id_link {
+  color: inherit;
+  visibility: hidden;
+}
+
+#docContent *:hover > a.id_link {
+  visibility: visible;
+}
+
 /**
   * Various callout boxes for docs, including warning, caution, note, tip
   */
#51Corey Huinker
corey.huinker@gmail.com
In reply to: Brar Piening (#50)
Re: doc: add missing "id" attributes to extension packaging page

TBH I'm a bit afraid that people will immediately start complaining
about the failing docs builds after this got applied since it forces
them to add ids to all varlistenries in a variablelist if they add one,
which can be perceived as quite a burden (also committers and reviewers
will have to get used to always watch out for failing docs builds
because of this).

As a person who had to re-rebase a patch because I discovered that id tags
had been added to one of the files I was working on, I can confidently say
"don't worry". It wasn't that big of a deal, I wasn't even following this
thread at the time and I immediately figured out what had happened and what
was expected of me. So it isn't that much of an inconvenience. If there is
a negative consequence to this change, it would be that it might
incentivize patch writers to omit documentation completely at the early
stages. But I don't think that's a problem because people generally see a
lack of documentation as a clue that maybe the patch isn't ready to be
reviewed, and this change would only reinforce that litmus test.

I had suggested we do something like this a few years back (the ids, that
is. the idea that we could check for compliance was beyond my imagination
at the time), and I'm glad to see both finally happening.

While I can foresee people overlooking the docs build, such oversights
won't go long before being caught, and the fix is simple. Now if we can
just get a threaded version of xlstproc to make the builds faster...

p.s. I'm "Team Paperclip" when it comes to the link hint, but let's get the
feature in first and worry about the right character later.

#52Karl O. Pinc
kop@karlpinc.com
In reply to: Corey Huinker (#51)
Re: doc: add missing "id" attributes to extension packaging page

Hi Brar,

It occurs to me that I had not actually tested the
way the anchor is put only after the last term in a
varlistentry. (The code looked obviously right
and should work if any varlistentry terms have anchors,
which they do, but....)

Have you tested this? If not, catalog.sgml, the
DEPENDENCY_PARTITION_SEC term is a 2nd term and usable
for at test case. But, at the moment there are no ids
for any of these varlistentries so you'd have to hack
them in.

Apologies for missing this.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#53Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#52)
Re: doc: add missing "id" attributes to extension packaging page

This is for the committer, as an FYI.

I cut out the <xsl:template name="section.heading"> portion
of the docbook XSLT and diffed it with the code for the
same template in the patch. The diff looks like:

-- /tmp/sections.xsl	2023-03-22 13:00:33.432968357 -0500
+++ /tmp/make_html_ids_discoverable_v3.patch	2023-03-22 13:03:39.776930603 -0500
@@ -52,5 +52,8 @@
       </xsl:call-template>
     </xsl:if>
     <xsl:copy-of select="$title"/>
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="$section"/>
+    </xsl:call-template>
   </xsl:element>
 </xsl:template>

(So, this output would start with line 52 of the template,
not from the top of the stock sections.xsl file.)

However, I am not really familiar with exactly what flavor
of docbook, version, namespace-d or not, etc., that PG
uses. So I could be diffing with the wrong thing.

Hope this helps and is not just noise.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#54Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#53)
Re: doc: add missing "id" attributes to extension packaging page

Hi Brar,

An observation: The # that shows up when hovering
over section-level headings is styled as the
section-level heading is. But the # that shows
up when hovering over varlistentrys has the default
text style.

This works for me. It's nice to have the "section #"s
look like the section heading. But the varlistentry's
terms are smaller than the normal font, and their
line width is less heavy than normal. I'm not really
invested one way or the other, but I find it kind of
nice that the varlistentry's #s are easier to click
on and more noticable because they're slightly larger
than might be expected.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#55Brar Piening
brar@gmx.de
In reply to: Karl O. Pinc (#52)
Re: doc: add missing "id" attributes to extension packaging page

On 23.03.2023 at 23:31, Karl O. Pinc wrote:

Hi Brar,

It occurs to me that I had not actually tested the
way the anchor is put only after the last term in a
varlistentry. (The code looked obviously right
and should work if any varlistentry terms have anchors,
which they do, but....)

Have you tested this?

Yes, I have. See
https://pgdocs.piening.info/app-psql.html#APP-PSQL-META-COMMAND-DE for
an extreme case.

#56Brar Piening
brar@gmx.de
In reply to: Karl O. Pinc (#54)
Re: doc: add missing "id" attributes to extension packaging page

On 24.03.2023 at 05:09, Karl O. Pinc wrote:

Hi Brar,

An observation: The # that shows up when hovering
over section-level headings is styled as the
section-level heading is. But the # that shows
up when hovering over varlistentrys has the default
text style.

This works for me. It's nice to have the "section #"s
look like the section heading. But the varlistentry's
terms are smaller than the normal font, and their
line width is less heavy than normal. I'm not really
invested one way or the other, but I find it kind of
nice that the varlistentry's #s are easier to click
on and more noticable because they're slightly larger
than might be expected.

TBH I didn't bother a lot with this.

Most of the time it's actually not the font size but rather the
font-family which gets inherited from the parent element if you don't
set it explicitly.

The link just inherits everithing (including the color, which I have set
to inherit explicitly since links don't inherit the parent's color by
default) from it's parent, which is the HTML <dt> element (ultimately
the inheritance probably goes up to the <body> element style in pretty
much all cases).

In some instances the input <term> element contains elements that are
styled differently in the output (e.g.: <literal> which translates to
HTML <code> which has "font-family: monospace;") which makes the # from
the link appear differently than the visible element it appears after.

Since (after tweaking the color) the general visual appearence looked ok
to me, I didn't bother with this any further.

Regards,

Brar

#57Brar Piening
brar@gmx.de
In reply to: Brar Piening (#56)
Re: doc: add missing "id" attributes to extension packaging page

On 24.03.2023 at 06:48, Brar Piening wrote:

Since (after tweaking the color) the general visual appearence looked
ok to me, I didn't bother with this any further.

Also, if we go on with this we'll probably end up in an almost
prototypical bikeshedding scenario where PostgreSQL itself is the
nuclear power plant and the visual appearence of the hover links on the
documentation website is the color of the bikeshed.

;-)

#58Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Brar Piening (#55)
Re: doc: add missing "id" attributes to extension packaging page

On 2023-Mar-24, Brar Piening wrote:

On 23.03.2023 at 23:31, Karl O. Pinc wrote:

Hi Brar,

It occurs to me that I had not actually tested the
way the anchor is put only after the last term in a
varlistentry. (The code looked obviously right
and should work if any varlistentry terms have anchors,
which they do, but....)

Have you tested this?

Yes, I have. See
https://pgdocs.piening.info/app-psql.html#APP-PSQL-META-COMMAND-DE for
an extreme case.

But why are there no anchors next to <h3> items on that page? For
example, how do I get the link for the "Meta Commands" subsection?

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
<inflex> really, I see PHP as like a strange amalgamation of C, Perl, Shell
<crab> inflex: you know that "amalgam" means "mixture with mercury",
more or less, right?
<crab> i.e., "deadly poison"

#59brar
brar@gmx.de
In reply to: Alvaro Herrera (#58)
Re: doc: add missing "id" attributes to extension packaging page
Show quoted text

But why are there no anchors next to> <h3> items on that page?  For example,> how do I get the link for the> "Meta Commands" subsection?I can't look at the code right now, but I suspect the headers are refsections (not sections) which this patch does not add links for yet.I already have plans to add this in a follow-up patch at some point, but while I had already added ids to all section elements in the previous patch that added ids, this has yet to be done for all refsect elements (wich is not a small effort again).Regards,Brar

#60Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: brar (#59)
Re: doc: add missing "id" attributes to extension packaging page

On 2023-Mar-24, brar wrote:

Alvaro wrote:

But why are there no anchors next to <h3> items on that page?  For
example, how do I get the link for the "Meta Commands" subsection?

I can't look at the code right now, but I suspect the headers are
refsections (not sections) which this patch does not add links for
yet. I already have plans to add this in a follow-up patch at some
point, but while I had already added ids to all section elements in
the previous patch that added ids, this has yet to be done for all
refsect elements (wich is not a small effort again).

You are right, those are <refsect2>. Understood, thanks.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
<inflex> really, I see PHP as like a strange amalgamation of C, Perl, Shell
<crab> inflex: you know that "amalgam" means "mixture with mercury",
more or less, right?
<crab> i.e., "deadly poison"

#61Brar Piening
brar@gmx.de
In reply to: Alvaro Herrera (#58)
Re: doc: add missing "id" attributes to extension packaging page

On 24.03.2023 at 10:45, Alvaro Herrera wrote:

But why are there no anchors next to <h3> items on that page? For
example, how do I get the link for the "Meta Commands" subsection?

I somehow knew that responding from a crappy mobile phone e-mail client
will mess up the format and the thread...

For those trying to follow the thread in the archives: my response (it's
probably a refsect which isn't supported yet) ended up here:
/messages/by-id/1N1fn0-1qd4xd1MyG-011ype@mail.gmx.net

Regards,

Brar

#62Brar Piening
brar@gmx.de
In reply to: Brar Piening (#50)
1 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On 23.03.2023 at 20:08, Brar Piening wrote:

Since the need for ids is starting to grow again (ecb696527c added an
id to a varlistentry in doc/src/sgml/ref/create_subscription.sgml)
I've also amended the add-needed-ids patch once again so that the
build does not fail after applying the make_html_ids_discoverable patch.

New add-needed-ids patch since it was outdated again.

Regards,

Brar

Attachments:

001-add-needed-ids_v3.postgresql.patchtext/plain; charset=UTF-8; name=001-add-needed-ids_v3.postgresql.patchDownload
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 71730cc52f..b0546f47b4 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -1132,7 +1132,7 @@ include_dir 'conf.d'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="guc-scram-iterations">
       <term><varname>scram_iterations</varname> (<type>integer</type>)
       <indexterm>
        <primary><varname>scram_iterations</varname> configuration parameter</primary>
diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 3836d13ad3..1432c67c2a 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -252,7 +252,7 @@
    additional columns not provided by the published table.  Any such columns
    will be filled with the default value as specified in the definition of the
    target table. However, logical replication in binary format is more
-   restrictive. See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
+   restrictive. See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal>
    option</link> of <command>CREATE SUBSCRIPTION</command> for details.
   </para>
 
diff --git a/doc/src/sgml/pgwalinspect.sgml b/doc/src/sgml/pgwalinspect.sgml
index 9a0241a8d6..62d9f9eb22 100644
--- a/doc/src/sgml/pgwalinspect.sgml
+++ b/doc/src/sgml/pgwalinspect.sgml
@@ -157,7 +157,7 @@ combined_size_percentage     | 2.8634072910530795
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="pgwalinspect-funcs-pg-get-wal-block-info">
     <term>
      <function>pg_get_wal_block_info(start_lsn pg_lsn, end_lsn pg_lsn) returns setof record</function>
     </term>
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e92346edef..f0ab6a918e 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -178,7 +178,7 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
           <literal>origin</literal> parameter.
          </para>
          <para>
-          See the <link linkend="sql-createsubscription-binary"><literal>binary</literal>
+          See the <link linkend="sql-createsubscription-with-binary"><literal>binary</literal>
           option</link> of <command>CREATE SUBSCRIPTION</command> for details
           about copying pre-existing data in binary format.
          </para>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 9d4b9d4e33..605b11bc67 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -61,7 +61,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
   <title>Parameters</title>
 
   <variablelist>
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-subscription-name">
     <term><replaceable class="parameter">subscription_name</replaceable></term>
     <listitem>
      <para>
@@ -70,7 +70,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-connection">
     <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
     <listitem>
      <para>
@@ -81,7 +81,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-publication">
     <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...]</literal></term>
     <listitem>
      <para>
@@ -90,7 +90,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="sql-createsubscription-with">
     <term><literal>WITH ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
     <listitem>
      <para>
@@ -102,7 +102,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-connect">
         <term><literal>connect</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -129,7 +129,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-create-slot">
         <term><literal>create_slot</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -145,7 +145,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-enabled">
         <term><literal>enabled</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -156,7 +156,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-slot-name">
         <term><literal>slot_name</literal> (<type>string</type>)</term>
         <listitem>
          <para>
@@ -185,7 +185,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
 
       <variablelist>
 
-       <varlistentry id="sql-createsubscription-binary" xreflabel="binary">
+       <varlistentry id="sql-createsubscription-with-binary" xreflabel="binary">
         <term><literal>binary</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-copy-data">
         <term><literal>copy_data</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -243,7 +243,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-streaming">
         <term><literal>streaming</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -271,7 +271,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-synchronous-commit">
         <term><literal>synchronous_commit</literal> (<type>enum</type>)</term>
         <listitem>
          <para>
@@ -303,7 +303,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-two-phase">
         <term><literal>two_phase</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -334,7 +334,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-disable-on-error">
         <term><literal>disable_on_error</literal> (<type>boolean</type>)</term>
         <listitem>
          <para>
@@ -346,7 +346,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
         </listitem>
        </varlistentry>
 
-       <varlistentry>
+       <varlistentry id="sql-createsubscription-with-origin">
         <term><literal>origin</literal> (<type>string</type>)</term>
         <listitem>
          <para>
#63Peter Smith
smithpb2250@gmail.com
In reply to: Brar Piening (#62)
Re: doc: add missing "id" attributes to extension packaging page

On Tue, Mar 28, 2023 at 4:06 AM Brar Piening <brar@gmx.de> wrote:

On 23.03.2023 at 20:08, Brar Piening wrote:

Since the need for ids is starting to grow again (ecb696527c added an
id to a varlistentry in doc/src/sgml/ref/create_subscription.sgml)
I've also amended the add-needed-ids patch once again so that the
build does not fail after applying the make_html_ids_discoverable patch.

New add-needed-ids patch since it was outdated again.

FYI, there is a lot of overlap between this last attachment and the
patches of Kuroda-san's current thread here [1]/messages/by-id/CAHut+Pvzo6=KKLqMR6-mAQdM+j_dse0eUreGmrFouL7gbLbv2w@mail.gmail.com which is also adding
ids to create_subscription.sgml.

(Anyway, I guess you might already be aware of that other thread
because your new ids look like they have the same names as those
chosen by Kuroda-san)

------
[1]: /messages/by-id/CAHut+Pvzo6=KKLqMR6-mAQdM+j_dse0eUreGmrFouL7gbLbv2w@mail.gmail.com

Kind Regards,
Peter Smith.
Fujitsu Australia

#64Brar Piening
brar@gmx.de
In reply to: Peter Smith (#63)
Re: doc: add missing "id" attributes to extension packaging page

On 28.03.2023 at 00:11, Peter Smith wrote:

FYI, there is a lot of overlap between this last attachment and the
patches of Kuroda-san's current thread here [1] which is also adding
ids to create_subscription.sgml.

(Anyway, I guess you might already be aware of that other thread
because your new ids look like they have the same names as those
chosen by Kuroda-san)

------
[1] /messages/by-id/CAHut+Pvzo6=KKLqMR6-mAQdM+j_dse0eUreGmrFouL7gbLbv2w@mail.gmail.com

Thanks, I actually was not aware of this.

Also, kudos for capturing the missing id and advocating for consistency
regarding ids even before this is actively enforced. This nurtures my
optimism that consistency might actually be achieveable without
everybody getting angry at me because my patch will enforce it.

Regarding the overlap, I currently try to make it as easy as possible
for a potential committer and I'm happy to rebase my patch upon request
or if Kuroda-san's patch gets applied first.

Regards,

Brar

#65Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: Brar Piening (#64)
RE: doc: add missing "id" attributes to extension packaging page

Dear my comrade Brar,

Thanks, I actually was not aware of this.

Also, kudos for capturing the missing id and advocating for consistency
regarding ids even before this is actively enforced. This nurtures my
optimism that consistency might actually be achieveable without
everybody getting angry at me because my patch will enforce it.

Regarding the overlap, I currently try to make it as easy as possible
for a potential committer and I'm happy to rebase my patch upon request
or if Kuroda-san's patch gets applied first.

FYI - my patch is pushed [1]https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=de5a47af2d8003dee123815bb7e58913be9a03f3. Could you please rebase your patch?
I think it's ok to just remove changes from logical-replication.sgml, ref/alter_subscription.sgml,
and ref/create_subscription.sgml.

[1]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=de5a47af2d8003dee123815bb7e58913be9a03f3

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

#66Brar Piening
brar@gmx.de
In reply to: Hayato Kuroda (Fujitsu) (#65)
1 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On 29.03.2023 at 06:52, Hayato Kuroda (Fujitsu) wrote:

FYI - my patch is pushed

Thanks!

Could you please rebase your patch?

Done and tested. Patch is attached.

Regards,

Brar

Attachments:

001-add-needed-ids_v4.postgresql.patchtext/plain; charset=UTF-8; name=001-add-needed-ids_v4.postgresql.patchDownload
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index fcb53c6997..5c50347c58 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -1132,7 +1132,7 @@ include_dir 'conf.d'
       </listitem>
      </varlistentry>
 
-     <varlistentry>
+     <varlistentry id="guc-scram-iterations">
       <term><varname>scram_iterations</varname> (<type>integer</type>)
       <indexterm>
        <primary><varname>scram_iterations</varname> configuration parameter</primary>
diff --git a/doc/src/sgml/pgwalinspect.sgml b/doc/src/sgml/pgwalinspect.sgml
index 9a0241a8d6..62d9f9eb22 100644
--- a/doc/src/sgml/pgwalinspect.sgml
+++ b/doc/src/sgml/pgwalinspect.sgml
@@ -157,7 +157,7 @@ combined_size_percentage     | 2.8634072910530795
     </listitem>
    </varlistentry>
 
-   <varlistentry>
+   <varlistentry id="pgwalinspect-funcs-pg-get-wal-block-info">
     <term>
      <function>pg_get_wal_block_info(start_lsn pg_lsn, end_lsn pg_lsn) returns setof record</function>
     </term>
#67Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: Brar Piening (#66)
RE: doc: add missing "id" attributes to extension packaging page

Dear Brar,

Thank you for updating the patch. The patch looks good to me.

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

#68Peter Eisentraut
peter.eisentraut@enterprisedb.com
In reply to: Brar Piening (#66)
Re: doc: add missing "id" attributes to extension packaging page

On 29.03.23 18:03, Brar Piening wrote:

On 29.03.2023 at 06:52, Hayato Kuroda (Fujitsu) wrote:

FYI - my patch is pushed

Thanks!

Could you please rebase your patch?

Done and tested. Patch is attached.

I have committed the most recent patch that added some missing IDs. (I
also added a missing xreflabel in passing.)

I'll look at the XSLT patch next.

#69Peter Eisentraut
peter.eisentraut@enterprisedb.com
In reply to: Brar Piening (#50)
Re: doc: add missing "id" attributes to extension packaging page

On 23.03.23 20:08, Brar Piening wrote:

I've also attached the (unchanged)  make_html_ids_discoverable patch for
convenience so this email now contains two patches for postgresql
(ending with .postgresql.patch) and one patch for pgweb (ending with
.pgweb.patch).

Here is my view on this:

First of all, it works very nicely and is very useful. Very welcome.

The XSLT implementation looks sound to me. It would be a touch better
if it had some comments about which parts of the templates were copied
from upstream stylesheets and which were changed. There are examples of
such commenting in the existing customization layer. Also, avoid
introducing whitespace differences during said copying.

However, I wonder if this is the right way to approach this. I don't
think we should put these link markers directly into the HTML. It feels
like this is the wrong layer. For example, if you have CSS turned off,
then all these # marks show up by default.

It seems to me that the correct way to do this is to hook in some
JavaScript that does this transformation directly on the DOM. Then we
don't need to carry this presentation detail in the HTML. Moreover, it
would avoid tight coupling between the website and the documentation
sources. You can produce the exact same DOM, that part seems okay, just
do it elsewhere. Was this approach considered? I didn't see it in the
thread.

#70Brar Piening
brar@gmx.de
In reply to: Peter Eisentraut (#69)
Re: doc: add missing "id" attributes to extension packaging page

On 04.04.2023 at 16:54, Peter Eisentraut wrote:

First of all, it works very nicely and is very useful.  Very welcome.

Thank you!

The XSLT implementation looks sound to me.  It would be a touch better
if it had some comments about which parts of the templates were copied
from upstream stylesheets and which were changed.  There are examples
of such commenting in the existing customization layer.  Also, avoid
introducing whitespace differences during said copying.

I will amend the patch if we agree that this is the way forward.

However, I wonder if this is the right way to approach this.  I don't
think we should put these link markers directly into the HTML.  It
feels like this is the wrong layer.  For example, if you have CSS
turned off, then all these # marks show up by default.

I'd consider this a feature rather than a problem but this is certainly
debatable. I cannot reliably predict what expectations a user who is
browsing the docs with CSS disabled might have. The opposite is true
too. If we'd move the id links feature to javascript, a user who has
javascript disabled will not see them. Is this what they'd want? I don't
know.

Also, while about 1-2% of users have Javascript disabled, I haven't
heard of disabling CSS except for debugging purposes.

In general I'd consider the fact that CSS or Javascript might be
disabled a niche problem that isn't really worth much debating but there
is definitely something to consider regarding people using screen
readers who might suffer from one or the other behavior and I'd
definitely be interested what behavior these users would expect. Would
they want to use the id link feature or would the links rather disrupt
their reading experience - I have no idea TBH and I hate speculating
about other people's preferences.

It seems to me that the correct way to do this is to hook in some
JavaScript that does this transformation directly on the DOM. Then we
don't need to carry this presentation detail in the HTML. Moreover, it
would avoid tight coupling between the website and the documentation
sources.  You can produce the exact same DOM, that part seems okay,
just do it elsewhere.  Was this approach considered?  I didn't see it
in the thread.

I briefly touched the topic in [1]/messages/by-id/68b9c435-d017-93cc-775a-c604db9ec683@gmx.de and [2]/messages/by-id/a75b6d7c-3fa4-d6a8-cf23-6b5180237392@gmx.de but we didin't really follow
up on the best approach.

Regards,

Brar

[1]: /messages/by-id/68b9c435-d017-93cc-775a-c604db9ec683@gmx.de
/messages/by-id/68b9c435-d017-93cc-775a-c604db9ec683@gmx.de

[2]: /messages/by-id/a75b6d7c-3fa4-d6a8-cf23-6b5180237392@gmx.de
/messages/by-id/a75b6d7c-3fa4-d6a8-cf23-6b5180237392@gmx.de

#71Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#70)
Re: doc: add missing "id" attributes to extension packaging page

On Tue, 4 Apr 2023 21:52:31 +0200
Brar Piening <brar@gmx.de> wrote:

On 04.04.2023 at 16:54, Peter Eisentraut wrote:

The XSLT implementation looks sound to me.  It would be a touch
better if it had some comments about which parts of the templates
were copied from upstream stylesheets and which were changed.

I like this idea. A lot. (Including which stylesheets were copied
from.)

However, I wonder if this is the right way to approach this.  I
don't think we should put these link markers directly into the
HTML.  It feels like this is the wrong layer.  For example, if you
have CSS turned off, then all these # marks show up by default.

I'd consider this a feature rather than a problem but this is
certainly debatable.

I too would consider this a feature. If you don't style your
html presentation, you see everything. The "#" links to content
are, well, content.

It seems to me that the correct way to do this is to hook in some
JavaScript that does this transformation directly on the DOM. Then
we don't need to carry this presentation detail in the HTML.

I would argue the opposite. The HTML/CSS is delivered to the browser
which is then free to present the content to the user in the
form preferred by the user. This puts control of presentation
in the hands of the end-user, where, IMO, it belongs.

Using JavaScript to manipulate the DOM is all well and good when
using AJAX to interact with the server to produce dynamic content.
But otherwise manipulating the DOM with JavaScript seems overly
heavy-handed, even though popular. It seems like JavaScript is
used more because CSS is difficult and an "extra technology" when
instead JavaScript can "do everything". So CSS is put aside.

I may be biased, not being a JavaScript fan. (I tend to be one
of those cranky individuals who keep JavaScript turned off.)
I'd rather not have code executing when such overhead/complication
can be avoided. (Insert here exciting argument about "what is code
and what is data".)

Glancing at the documentation source, I don't see JavaScript used
at all. Introducing it would be adding something else to the mix.
Not that this would be bad if it provides value.

In the end, I don't _really_ care. And don't do web development
all day either so my fundamentals could be just wrong. But
this is my take.

Moreover, it would avoid tight coupling between the website and the
documentation sources. 

I don't really understand this statement. Are you saying that
the documentation's source CSS needn't/shouldn't be the CSS used
on the website? That seems counter-intuitive. But then I don't
understand why the default CSS used when developing the documentation
is not the CSS used on the website.

I can imagine administrative arguments around server maintenance for
wanting to keep the website decoupled from the PG source code.
(I think.) But I can't speak to any of that.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#72Maciek Sakrejda
m.sakrejda@gmail.com
In reply to: Karl O. Pinc (#71)
Re: doc: add missing "id" attributes to extension packaging page

For what it's worth, I think having the anchors be always-visible when
CSS disabled is a feature. The content is still perfectly readable,
and the core feature from this patch is available. Introducing
JavaScript to lose that functionality seems like a step backwards.

By the way, the latest patch attachment was not the full patch series,
which I think confused cfbot: [1]https://commitfest.postgresql.org/42/4042/ (unless I'm misunderstanding the
state of the patch series).

And thanks for working on this. I've hunted in the page source for ids
to link to a number of times. I look forward to not doing that
anymore.

Thanks,
Maciek

[1]: https://commitfest.postgresql.org/42/4042/

#73Peter Eisentraut
peter.eisentraut@enterprisedb.com
In reply to: Brar Piening (#70)
Re: doc: add missing "id" attributes to extension packaging page

On 04.04.23 21:52, Brar Piening wrote:

The XSLT implementation looks sound to me.  It would be a touch better
if it had some comments about which parts of the templates were copied
from upstream stylesheets and which were changed.  There are examples
of such commenting in the existing customization layer.  Also, avoid
introducing whitespace differences during said copying.

I will amend the patch if we agree that this is the way forward.

Ok, it appears everyone agrees that this is the correct approach.
Please post an updated patch. There have been so many partial patches
posted recently, I'm not sure which one is the most current one and who
is really the author.

#74Brar Piening
brar@gmx.de
In reply to: Peter Eisentraut (#73)
2 attachment(s)
Re: doc: add missing "id" attributes to extension packaging page

On 06.04.2023 at 11:06, Peter Eisentraut wrote:

On 04.04.23 21:52, Brar Piening wrote:

The XSLT implementation looks sound to me.  It would be a touch better
if it had some comments about which parts of the templates were copied
from upstream stylesheets and which were changed.  There are examples
of such commenting in the existing customization layer.  Also, avoid
introducing whitespace differences during said copying.

I will amend the patch if we agree that this is the way forward.

Ok, it appears everyone agrees that this is the correct approach.
Please post an updated patch.  There have been so many partial patches
posted recently, I'm not sure which one is the most current one and
who is really the author.

Attached are two patches:

001-make_html_ids_discoverable_v5.postgresql.patch which needs to be
applied to the postgresql repository. It adds the XSLT to generate the
id links and the CSS to hide/display them. I've added comments as
suggested above.

002-add-discoverable-id-style_v1.pgweb.patch which needs to be applied
to the pgweb repository. It adds the CSS to the offical documentation site.

At the moment (commit 983ec23007) there are no missing ids, so the build
should just work after applying the patch but, as we already know, this
may change with every commit that gets added.

Reviewer is Karl O. Pink

Author is Brar Piening (with some additions from Karl O. Pink)

Best regards,

Brar

Attachments:

002-add-discoverable-id-style_v1.pgweb.patchtext/plain; charset=UTF-8; name=002-add-discoverable-id-style_v1.pgweb.patchDownload
diff --git a/media/css/main.css b/media/css/main.css
index 5f8bfdd5..c3464cd0 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1175,6 +1175,16 @@ code,
   padding-right: 2em;
 }
 
+/** Links to ids of headers and definition terms */
+#docContent a.id_link {
+  color: inherit;
+  visibility: hidden;
+}
+
+#docContent *:hover > a.id_link {
+  visibility: visible;
+}
+
 /**
   * Various callout boxes for docs, including warning, caution, note, tip
   */
001-make_html_ids_discoverable_v5.postgresql.patchtext/plain; charset=UTF-8; name=001-make_html_ids_discoverable_v5.postgresql.patchDownload
diff --git a/doc/src/sgml/stylesheet-html-common.xsl b/doc/src/sgml/stylesheet-html-common.xsl
index bb6429ef7c..8e5d9912d5 100644
--- a/doc/src/sgml/stylesheet-html-common.xsl
+++ b/doc/src/sgml/stylesheet-html-common.xsl
@@ -309,4 +309,137 @@ set       toc,title
   </xsl:choose>
 </xsl:template>
 
+
+<!-- Override the standard section heading generation in /xhtml/sections.xsl
+     to add an id link to each section heading. -->
+<xsl:template name="section.heading">
+  <xsl:param name="section" select="."/>
+  <xsl:param name="level" select="1"/>
+  <xsl:param name="allow-anchors" select="1"/>
+  <xsl:param name="title"/>
+  <xsl:param name="class" select="'title'"/>
+
+  <xsl:variable name="id">
+    <xsl:choose>
+      <!-- Make sure the subtitle doesn't get the same id as the title -->
+      <xsl:when test="self::subtitle">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="."/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- if title is in an *info wrapper, get the grandparent -->
+      <xsl:when test="contains(local-name(..), 'info')">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="../.."/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select=".."/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- HTML H level is one higher than section level -->
+  <xsl:variable name="hlevel">
+    <xsl:choose>
+      <!-- highest valid HTML H level is H6; so anything nested deeper
+           than 5 levels down just becomes H6 -->
+      <xsl:when test="$level &gt; 5">6</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$level + 1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
+    <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
+    <xsl:if test="$css.decoration != '0'">
+      <xsl:if test="$hlevel&lt;3">
+        <xsl:attribute name="style">clear: both</xsl:attribute>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="$allow-anchors != 0">
+      <xsl:call-template name="anchor">
+        <xsl:with-param name="node" select="$section"/>
+        <xsl:with-param name="conditional" select="0"/>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:copy-of select="$title"/>
+
+    <!--
+      The following code calls the template adding the links.
+      Everything else is copied from the original template.
+    -->
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="$section"/>
+    </xsl:call-template>
+
+  </xsl:element>
+</xsl:template>
+
+
+<!-- Override the standard template for varlistentry/term in /xhtml/lists.xsl
+     to add an id link after the last term. -->
+<xsl:template match="varlistentry/term">
+  <!-- Apply the original template -->
+  <xsl:apply-imports/>
+
+  <!-- Add the link after the last term -->
+  <xsl:if test="position() = last()">
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="parent::varlistentry"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+
+<!-- Create a link pointing to an id within the document -->
+<xsl:template name="pg.id.link">
+  <xsl:param name="object" select="."/>
+  <xsl:choose>
+    <xsl:when test="$object/@id or $object/@xml:id">
+      <xsl:text> </xsl:text>
+      <a>
+        <xsl:attribute name="href">
+          <xsl:text>#</xsl:text>
+          <xsl:call-template name="object.id">
+            <xsl:with-param name="object" select="$object"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="class">
+          <xsl:text>id_link</xsl:text>
+        </xsl:attribute>
+        <xsl:text>#</xsl:text>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- Only complain about varlistentries if at least one entry in
+           the list has an id -->
+      <xsl:if test="name($object) != 'varlistentry'
+                    or $object/parent::variablelist/varlistentry[@id]">
+        <xsl:message terminate="yes">
+          <xsl:text>&#10;</xsl:text>  <!-- leading newline -->
+          <xsl:text>Ids are required in order to provide the public</xsl:text>
+          <xsl:text> HTML documentation with stable URLs for &lt;</xsl:text>
+          <xsl:value-of select ="name($object)"/>
+          <xsl:text>&gt; element content; id missing at: </xsl:text>
+          <xsl:for-each select="$object/ancestor::*">
+            <xsl:text>/</xsl:text>
+            <xsl:value-of select ="name(.)"/>
+            <xsl:if test="@id|@xml:id">
+              <xsl:text>[@</xsl:text>
+              <xsl:value-of select ="name(@id|@xml:id)"/>
+              <xsl:text> = '</xsl:text>
+              <xsl:value-of select ="@id"/>
+              <xsl:text>']</xsl:text>
+            </xsl:if>
+          </xsl:for-each>
+          <xsl:text>&#10; </xsl:text>  <!-- trailing newline -->
+        </xsl:message>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index cc14efa1ca..15bcc95d41 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -169,3 +169,13 @@ acronym		{ font-style: inherit; }
     width: 75%;
   }
 }
+
+/* Links to ids of headers and definition terms */
+a.id_link {
+        color: inherit;
+        visibility: hidden;
+}
+
+*:hover > a.id_link {
+        visibility: visible;
+}
#75Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#74)
Re: doc: add missing "id" attributes to extension packaging page

On Thu, 6 Apr 2023 16:19:30 +0200
Brar Piening <brar@gmx.de> wrote:

Reviewer is Karl O. Pink

"Karl O. Pinc" actually, with a "c".

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#76Peter Eisentraut
peter.eisentraut@enterprisedb.com
In reply to: Brar Piening (#74)
Re: doc: add missing "id" attributes to extension packaging page

On 06.04.23 16:19, Brar Piening wrote:

001-make_html_ids_discoverable_v5.postgresql.patch which needs to be
applied to the postgresql repository. It adds the XSLT to generate the
id links and the CSS to hide/display them. I've added comments as
suggested above.

002-add-discoverable-id-style_v1.pgweb.patch which needs to be applied
to the pgweb repository. It adds the CSS to the offical documentation site.

The first patch has been committed.

The second patch should be sent to pgsql-www for integrating into the
web site.

Side project: I noticed that these new hover links don't appear in the
single-page HTML output (make postgres.html), even though the generated
HTML source code looks correct. Maybe someone has an idea there.

#77Brar Piening
brar@gmx.de
In reply to: Peter Eisentraut (#76)
Re: doc: add missing "id" attributes to extension packaging page

On 13.04.2023 at 10:31, Peter Eisentraut wrote:

The first patch has been committed.

Yay - thank you!

The second patch should be sent to pgsql-www for integrating into the
web site.

Done via [1]/messages/by-id/d987a4a7-62c3-7e0c-860f-1c96fc2117d9@gmx.de. Thanks for the hint.

Side project: I noticed that these new hover links don't appear in the
single-page HTML output (make postgres.html), even though the
generated HTML source code looks correct.  Maybe someone has an idea
there.

I feel responsible for the feature to work for all use cases where it
makes sense. I'll investigate this and post back.

Regards,
Brar

[1]: /messages/by-id/d987a4a7-62c3-7e0c-860f-1c96fc2117d9@gmx.de
/messages/by-id/d987a4a7-62c3-7e0c-860f-1c96fc2117d9@gmx.de

In reply to: Peter Eisentraut (#76)
Re: doc: add missing "id" attributes to extension packaging page

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:

On 06.04.23 16:19, Brar Piening wrote:

001-make_html_ids_discoverable_v5.postgresql.patch which needs to be
applied to the postgresql repository. It adds the XSLT to generate the
id links and the CSS to hide/display them. I've added comments as
suggested above.
002-add-discoverable-id-style_v1.pgweb.patch which needs to be applied
to the pgweb repository. It adds the CSS to the offical documentation site.

The first patch has been committed.

The second patch should be sent to pgsql-www for integrating into the
web site.

Side project: I noticed that these new hover links don't appear in the
single-page HTML output (make postgres.html), even though the generated
HTML source code looks correct. Maybe someone has an idea there.

Another side note: I notice the links don't appear on <refsectN> elements
(e.g. https://www.postgresql.org/docs/devel/sql-select.html#SQL-WITH),
only <sectN>.

- ilmari

#79Karl O. Pinc
kop@karlpinc.com
In reply to: Dagfinn Ilmari Mannsåker (#78)
Re: doc: add missing "id" attributes to extension packaging page

On Thu, 13 Apr 2023 15:58:03 +0100
Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote:

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:

The first patch has been committed.

Another side note: I notice the links don't appear on <refsectN>
elements (e.g.
https://www.postgresql.org/docs/devel/sql-select.html#SQL-WITH), only
<sectN>.

This we know. Working with <refsectN> elements is a different
dive into the XSLT which was deliberately put off for future
work.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#80Karl O. Pinc
kop@karlpinc.com
In reply to: Brar Piening (#77)
Re: doc: add missing "id" attributes to extension packaging page

On Thu, 13 Apr 2023 16:01:35 +0200
Brar Piening <brar@gmx.de> wrote:

On 13.04.2023 at 10:31, Peter Eisentraut wrote:

The first patch has been committed.

Yay - thank you!

The second patch should be sent to pgsql-www for integrating into
the web site.

Done via [1]. Thanks for the hint.

Side project: I noticed that these new hover links don't appear in
the single-page HTML output (make postgres.html), even though the
generated HTML source code looks correct.  Maybe someone has an idea
there.

I feel responsible for the feature to work for all use cases where it
makes sense. I'll investigate this and post back.

Looks to me like the ">" in the CSS was transformed into the &gt;
HTML entity when the stylesheet was included into the single-file
HTML.

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#81Karl O. Pinc
kop@karlpinc.com
In reply to: Karl O. Pinc (#80)
Re: doc: add missing "id" attributes to extension packaging page

On Thu, 13 Apr 2023 10:53:31 -0500
"Karl O. Pinc" <kop@karlpinc.com> wrote:

On Thu, 13 Apr 2023 16:01:35 +0200
Brar Piening <brar@gmx.de> wrote:

On 13.04.2023 at 10:31, Peter Eisentraut wrote:

Side project: I noticed that these new hover links don't appear in
the single-page HTML output (make postgres.html), even though the
generated HTML source code looks correct.  Maybe someone has an
idea there.

I feel responsible for the feature to work for all use cases where
it makes sense. I'll investigate this and post back.

Looks to me like the ">" in the CSS was transformed into the &gt;
HTML entity when the stylesheet was included into the single-file
HTML.

The XSLT 1.0 spec says that characters in <style> elements should
not be escaped when outputting HTML. [4] But (I think) the
generate.css.header parameter method [1][2] of
inserting the CSS into the HTML expands the CSS content
in an XML context, not a HTML context.

I've played around with it, going so far as to make stylesheet.css
look like:

--------------<snip>--------
<!DOCTYPE xsl:stylesheet [
<!ENTITY css SYSTEM "stylesheet.css">
]>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform&quot;&gt;
&css;
</xsl:stylesheet>
--------------<snip>--------

and even substituted the actual text of stylesheet.css in
place of the &css; entity reference. In these cases the
"<" character is still entity expanded, resulting in broken CSS.

My conclusion is that this method is broken.

(The other possibility, I suppose, is that xsltproc is broken.)

I think the thing to try is the sagehill.net approach [4].
This overrides the user.head.content template. My hope is
that because the &css; entity is seen in a <style> element
in the template, that xsltproc then recognizances style element
content in a HTML output context.

(I don't know how xsltproc is supposed to know that it is
in a HTML output context. I suppose exploring this would
be another avenue should the above fail.)

1
https://docbook.sourceforge.net/release/xsl/current/doc/html/custom.css.source.html

2
https://docbook.sourceforge.net/release/xsl/current/doc/html/generate.css.header.html

3 http://sagehill.net/docbookxsl/HtmlHead.html#EmbedCSS

4 https://www.w3.org/TR/xslt-10/#section-HTML-Output-Method

Regards,

Karl <kop@karlpinc.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

#82Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Karl O. Pinc (#79)
Re: doc: add missing "id" attributes to extension packaging page

On 2023-Apr-13, Karl O. Pinc wrote:

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote:

Another side note: I notice the links don't appear on <refsectN>
elements (e.g.
https://www.postgresql.org/docs/devel/sql-select.html#SQL-WITH),
only <sectN>.

This we know. Working with <refsectN> elements is a different
dive into the XSLT which was deliberately put off for future
work.

Hi, has anybody been able to spend some time on the <refsectN> aspect of
these link things?

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"No hay ausente sin culpa ni presente sin disculpa" (Prov. francés)

#83Brar Piening
brar@gmx.de
In reply to: Alvaro Herrera (#82)
Re: doc: add missing "id" attributes to extension packaging page

On 2025-11-14 at 11:59 Alvaro Herrera wrote:

On 2023-Apr-13, Karl O. Pinc wrote:

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote:

Another side note: I notice the links don't appear on <refsectN>
elements (e.g.
https://www.postgresql.org/docs/devel/sql-select.html#SQL-WITH),
only <sectN>.

This we know. Working with <refsectN> elements is a different
dive into the XSLT which was deliberately put off for future
work.

Hi, has anybody been able to spend some time on the <refsectN> aspect of
these link things?

Hi,

tbh, this has been in my backlog since I did the initial thing.

I haven't prioritized it since it is really a completely different area
XSLT-wise that cannot build on the changes I have made and I wanted to
see how well my initial work will prove its value and be accepted by the
maintainers and the community before starting to work on this and
introducing even more changes in this kind of ugly XSLT area that nobody
really likes to touch.

I think, now that some  time has passed, everybody working on patches in
the docs area should have some opinion on how annoying it is to be
forced to provide ids for various elements and if the advantage of being
able to refer to specific items in the HTML docs is really worth it.

Also, as we've learnt the last time, a patch that enforces the presence
of ids in refsections would need to be applied in a quick and
cooperative way once we agree on the general structure, since it needs
to be rebased and enhanced whenever a new refsection without ids (or
other element where it enforces ids) is added by some patch and will
break all subsequent patches that try to add refsections without ids
(forcing their developers/reviewers to rebase and add ids accordingly).

If we can build some consensus that we want this for the refsections as
well, I'm willing to put some time aside and work on this (probably at
some point next year since I'm currently drowning in work).

Regards,

Barr