diff --git a/doc/src/sgml/contrib-prog.sgml b/doc/src/sgml/contrib-prog.sgml
new file mode 100644
index 0000000000..0912ede300
--- /dev/null
+++ b/doc/src/sgml/contrib-prog.sgml
@@ -0,0 +1,60 @@
+<!-- doc/src/sgml/contrib-prog.sgml -->
+
+<!--
+'contrib.sgml' and 'contrib-prog.sgml are two separate appendixes because it is 
+difficult to mix regular
+sections (for extensions) and refentries (for programs) in one chapter or
+appendix.  And we do want the programs as refentries so that we can produce man
+pages.
+-->
+
+<appendix id="contrib-prog">
+ <title>Additional Supplied Programs</title>
+
+ <para>
+  This appendix and the previous one contain information regarding the modules that
+  can be found in the <literal>contrib</literal> directory of the
+  <productname>PostgreSQL</productname> distribution.  See <xref linkend="contrib"/> for
+  more information about the <literal>contrib</literal> section in general and
+  server extensions and plug-ins found in <literal>contrib</literal>
+  specifically.
+ </para>
+
+ <para>
+  This appendix covers utility programs found in <literal>contrib</literal>.
+  Once installed, either from source or a packaging system, they are found in
+  the <filename>bin</filename> directory of the
+  <productname>PostgreSQL</productname> installation and can be used like any
+  other program.
+ </para>
+
+ <sect1 id="contrib-prog-client">
+  <title>Client Applications</title>
+
+  <para>
+   This section covers <productname>PostgreSQL</productname> client
+   applications in <literal>contrib</literal>.  They can be run from anywhere,
+   independent of where the database server resides.  See
+   also <xref linkend="reference-client"/> for information about client
+   applications that part of the core <productname>PostgreSQL</productname>
+   distribution.
+  </para>
+
+ &oid2name;
+ &vacuumlo;
+ </sect1>
+
+ <sect1 id="contrib-prog-server">
+  <title>Server Applications</title>
+
+  <para>
+   This section covers <productname>PostgreSQL</productname> server-related
+   applications in <literal>contrib</literal>.  They are typically run on the
+   host where the database server resides.  See also <xref
+   linkend="reference-server"/> for information about server applications that
+   part of the core <productname>PostgreSQL</productname> distribution.
+  </para>
+
+ &pgstandby;
+ </sect1>
+</appendix>
diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml
index b626a345f3..7ea33da2ae 100644
--- a/doc/src/sgml/contrib.sgml
+++ b/doc/src/sgml/contrib.sgml
@@ -150,60 +150,3 @@ CREATE EXTENSION <replaceable>module_name</replaceable> FROM unpackaged;
 
 </appendix>
 
-<!--
-These are two separate appendixes because it is difficult to mix regular
-sections (for extensions) and refentries (for programs) in one chapter or
-appendix.  And we do want the programs as refentries so that we can produce man
-pages.
--->
-
-<appendix id="contrib-prog">
- <title>Additional Supplied Programs</title>
-
- <para>
-  This appendix and the previous one contain information regarding the modules that
-  can be found in the <literal>contrib</literal> directory of the
-  <productname>PostgreSQL</productname> distribution.  See <xref linkend="contrib"/> for
-  more information about the <literal>contrib</literal> section in general and
-  server extensions and plug-ins found in <literal>contrib</literal>
-  specifically.
- </para>
-
- <para>
-  This appendix covers utility programs found in <literal>contrib</literal>.
-  Once installed, either from source or a packaging system, they are found in
-  the <filename>bin</filename> directory of the
-  <productname>PostgreSQL</productname> installation and can be used like any
-  other program.
- </para>
-
- <sect1 id="contrib-prog-client">
-  <title>Client Applications</title>
-
-  <para>
-   This section covers <productname>PostgreSQL</productname> client
-   applications in <literal>contrib</literal>.  They can be run from anywhere,
-   independent of where the database server resides.  See
-   also <xref linkend="reference-client"/> for information about client
-   applications that part of the core <productname>PostgreSQL</productname>
-   distribution.
-  </para>
-
- &oid2name;
- &vacuumlo;
- </sect1>
-
- <sect1 id="contrib-prog-server">
-  <title>Server Applications</title>
-
-  <para>
-   This section covers <productname>PostgreSQL</productname> server-related
-   applications in <literal>contrib</literal>.  They are typically run on the
-   host where the database server resides.  See also <xref
-   linkend="reference-server"/> for information about server applications that
-   part of the core <productname>PostgreSQL</productname> distribution.
-  </para>
-
- &pgstandby;
- </sect1>
-</appendix>
diff --git a/doc/src/sgml/errcodes.sgml b/doc/src/sgml/errcodes.sgml
index 6fd16f643e..8e96dfdf32 100644
--- a/doc/src/sgml/errcodes.sgml
+++ b/doc/src/sgml/errcodes.sgml
@@ -77,11 +77,8 @@
    </row>
   </thead>
 
-  <tbody>
+  &errcodes-table;
 
-    &errcodes-table;
-
-  </tbody>
  </tgroup>
 </table>
 
diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml
index a6b77c1cfe..6e26870fcd 100644
--- a/doc/src/sgml/extend.sgml
+++ b/doc/src/sgml/extend.sgml
@@ -310,10 +310,495 @@
    </sect2>
   </sect1>
 
-  &xfunc;
+ <sect1 id="xfunc">
+  <title>User-defined Functions</title>
+
+  <indexterm zone="xfunc">
+   <primary>function</primary>
+   <secondary>user-defined</secondary>
+  </indexterm>
+
+  <para>
+   <productname>PostgreSQL</productname> provides four kinds of
+   functions:
+
+   <itemizedlist>
+    <listitem>
+     <para>
+      query language functions (functions written in
+      <acronym>SQL</acronym>) (<xref linkend="xfunc-sql"/>)
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      procedural language functions (functions written in, for
+      example, <application>PL/pgSQL</application> or <application>PL/Tcl</application>)
+      (<xref linkend="xfunc-pl"/>)
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      internal functions (<xref linkend="xfunc-internal"/>)
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      C-language functions (<xref linkend="xfunc-c"/>)
+     </para>
+    </listitem>
+   </itemizedlist>
+  </para>
+
+  <para>
+   Every kind
+   of  function  can take base types, composite types, or
+   combinations of these as arguments (parameters). In addition,
+   every kind of function can return a base type or
+   a composite type.  Functions can also be defined to return
+   sets of base or composite values.
+  </para>
+
+  <para>
+   Many kinds of functions can take or return certain pseudo-types
+   (such as polymorphic types), but the available facilities vary.
+   Consult the description of each kind of function for more details.
+  </para>
+
+  <para>
+   It's easiest to define <acronym>SQL</acronym>
+   functions, so we'll start by discussing those.
+   Most of the concepts presented for <acronym>SQL</acronym> functions
+   will carry over to the other types of functions.
+  </para>
+
+  <para>
+   Throughout this chapter, it can be useful to look at the reference
+   page of the <xref linkend="sql-createfunction"/> command to
+   understand the examples better.  Some examples from this chapter
+   can be found in <filename>funcs.sql</filename> and
+   <filename>funcs.c</filename> in the <filename>src/tutorial</filename>
+   directory in the <productname>PostgreSQL</productname> source
+   distribution.
+  </para>
+  </sect1>
+
+  <sect1 id="xproc">
+   <title>User-defined Procedures</title>
+
+  <indexterm zone="xproc">
+   <primary>procedure</primary>
+   <secondary>user-defined</secondary>
+  </indexterm>
+
+   <para>
+    A procedure is a database object similar to a function.  The difference is
+    that a procedure does not return a value, so there is no return type
+    declaration.  While a function is called as part of a query or DML
+    command, a procedure is called explicitly using
+    the <xref linkend="sql-call"/> statement.
+   </para>
+
+   <para>
+    The explanations on how to define user-defined functions in the rest of
+    this chapter apply to procedures as well, except that
+    the <xref linkend="sql-createprocedure"/> command is used instead, there is
+    no return type, and some other features such as strictness don't apply.
+   </para>
+
+   <para>
+    Collectively, functions and procedures are also known
+    as <firstterm>routines</firstterm><indexterm><primary>routine</primary></indexterm>.
+    There are commands such as <xref linkend="sql-alterroutine"/>
+    and <xref linkend="sql-droproutine"/> that can operate on functions and
+    procedures without having to know which kind it is.  Note, however, that
+    there is no <literal>CREATE ROUTINE</literal> command.
+   </para>
+  </sect1>
+
+  &xfunc-sql;
+
+  <sect1 id="xfunc-overload">
+   <title>Function Overloading</title>
+
+   <indexterm zone="xfunc-overload">
+    <primary>overloading</primary>
+    <secondary>functions</secondary>
+   </indexterm>
+
+   <para>
+    More than one function can be defined with the same SQL name, so long
+    as the arguments they take are different.  In other words,
+    function names can be <firstterm>overloaded</firstterm>.  Whether or not
+    you use it, this capability entails security precautions when calling
+    functions in databases where some users mistrust other users; see
+    <xref linkend="typeconv-func"/>.  When a query is executed, the server
+    will determine which function to call from the data types and the number
+    of the provided arguments.  Overloading can also be used to simulate
+    functions with a variable number of arguments, up to a finite maximum
+    number.
+   </para>
+
+   <para>
+    When creating a family of overloaded functions, one should be
+    careful not to create ambiguities.  For instance, given the
+    functions:
+<programlisting>
+CREATE FUNCTION test(int, real) RETURNS ...
+CREATE FUNCTION test(smallint, double precision) RETURNS ...
+</programlisting>
+    it is not immediately clear which function would be called with
+    some trivial input like <literal>test(1, 1.5)</literal>.  The
+    currently implemented resolution rules are described in
+    <xref linkend="typeconv"/>, but it is unwise to design a system that subtly
+    relies on this behavior.
+   </para>
+
+   <para>
+    A function that takes a single argument of a composite type should
+    generally not have the same name as any attribute (field) of that type.
+    Recall that <literal><replaceable>attribute</replaceable>(<replaceable>table</replaceable>)</literal>
+    is considered equivalent
+    to <literal><replaceable>table</replaceable>.<replaceable>attribute</replaceable></literal>.
+    In the case that there is an
+    ambiguity between a function on a composite type and an attribute of
+    the composite type, the attribute will always be used.  It is possible
+    to override that choice by schema-qualifying the function name
+    (that is, <literal><replaceable>schema</replaceable>.<replaceable>func</replaceable>(<replaceable>table</replaceable>)
+    </literal>) but it's better to
+    avoid the problem by not choosing conflicting names.
+   </para>
+
+   <para>
+    Another possible conflict is between variadic and non-variadic functions.
+    For instance, it is possible to create both <literal>foo(numeric)</literal> and
+    <literal>foo(VARIADIC numeric[])</literal>.  In this case it is unclear which one
+    should be matched to a call providing a single numeric argument, such as
+    <literal>foo(10.1)</literal>.  The rule is that the function appearing
+    earlier in the search path is used, or if the two functions are in the
+    same schema, the non-variadic one is preferred.
+   </para>
+
+   <para>
+    When overloading C-language functions, there is an additional
+    constraint: The C name of each function in the family of
+    overloaded functions must be different from the C names of all
+    other functions, either internal or dynamically loaded.  If this
+    rule is violated, the behavior is not portable.  You might get a
+    run-time linker error, or one of the functions will get called
+    (usually the internal one).  The alternative form of the
+    <literal>AS</literal> clause for the SQL <command>CREATE
+    FUNCTION</command> command decouples the SQL function name from
+    the function name in the C source code.  For instance:
+<programlisting>
+CREATE FUNCTION test(int) RETURNS int
+    AS '<replaceable>filename</replaceable>', 'test_1arg'
+    LANGUAGE C;
+CREATE FUNCTION test(int, int) RETURNS int
+    AS '<replaceable>filename</replaceable>', 'test_2arg'
+    LANGUAGE C;
+</programlisting>
+    The names of the C functions here reflect one of many possible conventions.
+   </para>
+  </sect1>
+
+  <sect1 id="xfunc-volatility">
+   <title>Function Volatility Categories</title>
+
+   <indexterm zone="xfunc-volatility">
+    <primary>volatility</primary>
+    <secondary>functions</secondary>
+   </indexterm>
+   <indexterm zone="xfunc-volatility">
+    <primary>VOLATILE</primary>
+   </indexterm>
+   <indexterm zone="xfunc-volatility">
+    <primary>STABLE</primary>
+   </indexterm>
+   <indexterm zone="xfunc-volatility">
+    <primary>IMMUTABLE</primary>
+   </indexterm>
+
+   <para>
+    Every function has a <firstterm>volatility</firstterm> classification, with
+    the possibilities being <literal>VOLATILE</literal>, <literal>STABLE</literal>, or
+    <literal>IMMUTABLE</literal>.  <literal>VOLATILE</literal> is the default if the
+    <xref linkend="sql-createfunction"/>
+    command does not specify a category.  The volatility category is a
+    promise to the optimizer about the behavior of the function:
+
+   <itemizedlist>
+    <listitem>
+     <para>
+      A <literal>VOLATILE</literal> function can do anything, including modifying
+      the database.  It can return different results on successive calls with
+      the same arguments.  The optimizer makes no assumptions about the
+      behavior of such functions.  A query using a volatile function will
+      re-evaluate the function at every row where its value is needed.
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      A <literal>STABLE</literal> function cannot modify the database and is
+      guaranteed to return the same results given the same arguments
+      for all rows within a single statement. This category allows the
+      optimizer to optimize multiple calls of the function to a single
+      call. In particular, it is safe to use an expression containing
+      such a function in an index scan condition. (Since an index scan
+      will evaluate the comparison value only once, not once at each
+      row, it is not valid to use a <literal>VOLATILE</literal> function in an
+      index scan condition.)
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      An <literal>IMMUTABLE</literal> function cannot modify the database and is
+      guaranteed to return the same results given the same arguments forever.
+      This category allows the optimizer to pre-evaluate the function when
+      a query calls it with constant arguments.  For example, a query like
+      <literal>SELECT ... WHERE x = 2 + 2</literal> can be simplified on sight to
+      <literal>SELECT ... WHERE x = 4</literal>, because the function underlying
+      the integer addition operator is marked <literal>IMMUTABLE</literal>.
+     </para>
+    </listitem>
+   </itemizedlist>
+   </para>
+
+   <para>
+    For best optimization results, you should label your functions with the
+    strictest volatility category that is valid for them.
+   </para>
+
+   <para>
+    Any function with side-effects <emphasis>must</emphasis> be labeled
+    <literal>VOLATILE</literal>, so that calls to it cannot be optimized away.
+    Even a function with no side-effects needs to be labeled
+    <literal>VOLATILE</literal> if its value can change within a single query;
+    some examples are <literal>random()</literal>, <literal>currval()</literal>,
+    <literal>timeofday()</literal>.
+   </para>
+
+   <para>
+    Another important example is that the <function>current_timestamp</function>
+    family of functions qualify as <literal>STABLE</literal>, since their values do
+    not change within a transaction.
+   </para>
+
+   <para>
+    There is relatively little difference between <literal>STABLE</literal> and
+    <literal>IMMUTABLE</literal> categories when considering simple interactive
+    queries that are planned and immediately executed: it doesn't matter
+    a lot whether a function is executed once during planning or once during
+    query execution startup.  But there is a big difference if the plan is
+    saved and reused later.  Labeling a function <literal>IMMUTABLE</literal> when
+    it really isn't might allow it to be prematurely folded to a constant during
+    planning, resulting in a stale value being re-used during subsequent uses
+    of the plan.  This is a hazard when using prepared statements or when
+    using function languages that cache plans (such as
+    <application>PL/pgSQL</application>).
+   </para>
+
+   <para>
+    For functions written in SQL or in any of the standard procedural
+    languages, there is a second important property determined by the
+    volatility category, namely the visibility of any data changes that have
+    been made by the SQL command that is calling the function.  A
+    <literal>VOLATILE</literal> function will see such changes, a <literal>STABLE</literal>
+    or <literal>IMMUTABLE</literal> function will not.  This behavior is implemented
+    using the snapshotting behavior of MVCC (see <xref linkend="mvcc"/>):
+    <literal>STABLE</literal> and <literal>IMMUTABLE</literal> functions use a snapshot
+    established as of the start of the calling query, whereas
+    <literal>VOLATILE</literal> functions obtain a fresh snapshot at the start of
+    each query they execute.
+   </para>
+
+   <note>
+    <para>
+     Functions written in C can manage snapshots however they want, but it's
+     usually a good idea to make C functions work this way too.
+    </para>
+   </note>
+
+   <para>
+    Because of this snapshotting behavior,
+    a function containing only <command>SELECT</command> commands can safely be
+    marked <literal>STABLE</literal>, even if it selects from tables that might be
+    undergoing modifications by concurrent queries.
+    <productname>PostgreSQL</productname> will execute all commands of a
+    <literal>STABLE</literal> function using the snapshot established for the
+    calling query, and so it will see a fixed view of the database throughout
+    that query.
+   </para>
+
+   <para>
+    The same snapshotting behavior is used for <command>SELECT</command> commands
+    within <literal>IMMUTABLE</literal> functions.  It is generally unwise to select
+    from database tables within an <literal>IMMUTABLE</literal> function at all,
+    since the immutability will be broken if the table contents ever change.
+    However, <productname>PostgreSQL</productname> does not enforce that you
+    do not do that.
+   </para>
+
+   <para>
+    A common error is to label a function <literal>IMMUTABLE</literal> when its
+    results depend on a configuration parameter.  For example, a function
+    that manipulates timestamps might well have results that depend on the
+    <xref linkend="guc-timezone"/> setting.  For safety, such functions should
+    be labeled <literal>STABLE</literal> instead.
+   </para>
+
+   <note>
+    <para>
+     <productname>PostgreSQL</productname> requires that <literal>STABLE</literal>
+     and <literal>IMMUTABLE</literal> functions contain no SQL commands other
+     than <command>SELECT</command> to prevent data modification.
+     (This is not a completely bulletproof test, since such functions could
+     still call <literal>VOLATILE</literal> functions that modify the database.
+     If you do that, you will find that the <literal>STABLE</literal> or
+     <literal>IMMUTABLE</literal> function does not notice the database changes
+     applied by the called function, since they are hidden from its snapshot.)
+    </para>
+   </note>
+  </sect1>
+
+  <sect1 id="xfunc-pl">
+   <title>Procedural Language Functions</title>
+
+   <para>
+    <productname>PostgreSQL</productname> allows user-defined functions
+    to be written in other languages besides SQL and C.  These other
+    languages are generically called <firstterm>procedural
+    languages</firstterm> (<acronym>PL</acronym>s).
+    Procedural languages aren't built into the
+    <productname>PostgreSQL</productname> server; they are offered
+    by loadable modules.
+    See <xref linkend="xplang"/> and following chapters for more
+    information.
+   </para>
+  </sect1>
+
+  <sect1 id="xfunc-internal">
+   <title>Internal Functions</title>
+
+   <indexterm zone="xfunc-internal"><primary>function</primary><secondary>internal</secondary></indexterm>
+
+   <para>
+    Internal functions are functions written in C that have been statically
+    linked into the <productname>PostgreSQL</productname> server.
+    The <quote>body</quote> of the function definition
+    specifies the C-language name of the function, which need not be the
+    same as the name being declared for SQL use.
+    (For reasons of backward compatibility, an empty body
+    is accepted as meaning that the C-language function name is the
+    same as the SQL name.)
+   </para>
+
+   <para>
+    Normally, all internal functions present in the
+    server are declared during the initialization of the database cluster
+    (see <xref linkend="creating-cluster"/>),
+    but a user could use <command>CREATE FUNCTION</command>
+    to create additional alias names for an internal function.
+    Internal functions are declared in <command>CREATE FUNCTION</command>
+    with language name <literal>internal</literal>.  For instance, to
+    create an alias for the <function>sqrt</function> function:
+<programlisting>
+CREATE FUNCTION square_root(double precision) RETURNS double precision
+    AS 'dsqrt'
+    LANGUAGE internal
+    STRICT;
+</programlisting>
+    (Most internal functions expect to be declared <quote>strict</quote>.)
+   </para>
+
+   <note>
+    <para>
+     Not all <quote>predefined</quote> functions are
+     <quote>internal</quote> in the above sense.  Some predefined
+     functions are written in SQL.
+    </para>
+   </note>
+  </sect1>
+
+  &xfunc;  <!-- xfunc-c part -->
   &xaggr;
   &xtypes;
-  &xoper;
+
+ <sect1 id="xoper">
+  <title>User-defined Operators</title>
+
+  <indexterm zone="xoper">
+   <primary>operator</primary>
+   <secondary>user-defined</secondary>
+  </indexterm>
+
+  <para>
+   Every operator is <quote>syntactic sugar</quote> for a call to an
+   underlying function that does the real work; so you must
+   first create the underlying function before you can create
+   the operator.  However, an operator is <emphasis>not merely</emphasis>
+   syntactic sugar, because it carries additional information
+   that helps the query planner optimize queries that use the
+   operator.  The next section will be devoted to explaining
+   that additional information.
+  </para>
+
+  <para>
+   <productname>PostgreSQL</productname> supports left unary, right
+   unary, and binary operators.  Operators can be
+   overloaded;<indexterm><primary>overloading</primary><secondary>operators</secondary></indexterm>
+   that is, the same operator name can be used for different operators
+   that have different numbers and types of operands.  When a query is
+   executed, the system determines the operator to call from the
+   number and types of the provided operands.
+  </para>
+
+  <para>
+   Here is an example of creating an operator for adding two complex
+   numbers.  We assume we've already created the definition of type
+   <type>complex</type> (see <xref linkend="xtypes"/>).  First we need a
+   function that does the work, then we can define the operator:
+
+<programlisting>
+CREATE FUNCTION complex_add(complex, complex)
+    RETURNS complex
+    AS '<replaceable>filename</replaceable>', 'complex_add'
+    LANGUAGE C IMMUTABLE STRICT;
+
+CREATE OPERATOR + (
+    leftarg = complex,
+    rightarg = complex,
+    function = complex_add,
+    commutator = +
+);
+</programlisting>
+  </para>
+
+  <para>
+   Now we could execute a query like this:
+
+<screen>
+SELECT (a + b) AS c FROM test_complex;
+
+        c
+-----------------
+ (5.2,6.05)
+ (133.42,144.95)
+</screen>
+  </para>
+
+  <para>
+   We've shown how to create a binary operator here.  To create unary
+   operators, just omit one of <literal>leftarg</literal> (for left unary) or
+   <literal>rightarg</literal> (for right unary).  The <literal>function</literal>
+   clause and the argument clauses are the only required items in
+   <command>CREATE OPERATOR</command>.  The <literal>commutator</literal>
+   clause shown in the example is an optional hint to the query
+   optimizer.  Further details about <literal>commutator</literal> and other
+   optimizer hints appear in the next section.
+  </para>
+ </sect1>
+
+  &xoper;   <!-- xoper-optimization part -->
   &xindex;
 
 
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index 5dfdf54815..3d33b906ee 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -65,6 +65,7 @@
 <!ENTITY event-trigger SYSTEM "event-trigger.sgml">
 <!ENTITY xaggr      SYSTEM "xaggr.sgml">
 <!ENTITY xfunc      SYSTEM "xfunc.sgml">
+<!ENTITY xfunc-sql  SYSTEM "xfunc-sql.sgml">
 <!ENTITY xindex     SYSTEM "xindex.sgml">
 <!ENTITY xplang     SYSTEM "xplang.sgml">
 <!ENTITY xoper      SYSTEM "xoper.sgml">
@@ -104,6 +105,7 @@
 
 <!-- contrib information -->
 <!ENTITY contrib         SYSTEM "contrib.sgml">
+<!ENTITY contrib-prog    SYSTEM "contrib-prog.sgml">
 <!ENTITY adminpack       SYSTEM "adminpack.sgml">
 <!ENTITY amcheck         SYSTEM "amcheck.sgml">
 <!ENTITY auth-delay      SYSTEM "auth-delay.sgml">
diff --git a/doc/src/sgml/generate-errcodes-table.pl b/doc/src/sgml/generate-errcodes-table.pl
index 24b9d891c3..022abf9d20 100644
--- a/doc/src/sgml/generate-errcodes-table.pl
+++ b/doc/src/sgml/generate-errcodes-table.pl
@@ -8,6 +8,7 @@ use strict;
 
 print
   "<!-- autogenerated from src/backend/utils/errcodes.txt, do not edit -->\n";
+print "<tbody>\n";
 
 open my $errcodes, '<', $ARGV[0] or die;
 
@@ -56,4 +57,5 @@ while (<$errcodes>)
 	print "</row>\n";
 }
 
+print "</tbody>\n";
 close $errcodes;
diff --git a/doc/src/sgml/legal.sgml b/doc/src/sgml/legal.sgml
index 9bb1d7983b..03e2a810d5 100644
--- a/doc/src/sgml/legal.sgml
+++ b/doc/src/sgml/legal.sgml
@@ -1,5 +1,10 @@
 <!-- doc/src/sgml/legal.sgml -->
 
+<bookinfo>
+ <corpauthor>The PostgreSQL Global Development Group</corpauthor>
+ <productname>PostgreSQL</productname>
+ <productnumber>&version;</productnumber>
+
 <date>2019</date>
 
 <copyright>
@@ -46,3 +51,5 @@
  </para>
 
 </legalnotice>
+</bookinfo>
+
diff --git a/doc/src/sgml/postgres.sgml b/doc/src/sgml/postgres.sgml
index 96d196d229..c49cc45839 100644
--- a/doc/src/sgml/postgres.sgml
+++ b/doc/src/sgml/postgres.sgml
@@ -16,13 +16,7 @@
 <book id="postgres">
  <title>PostgreSQL &version; Documentation</title>
 
- <bookinfo>
-  <corpauthor>The PostgreSQL Global Development Group</corpauthor>
-  <productname>PostgreSQL</productname>
-  <productnumber>&version;</productnumber>
-  &legal;
- </bookinfo>
-
+ &legal;
  &intro;
 
  <part id="tutorial">
@@ -272,6 +266,7 @@
   &features;
   &release;
   &contrib;
+  &contrib-prog;
   &external-projects;
   &sourcerepo;
   &docguide;
diff --git a/doc/src/sgml/release-10.sgml b/doc/src/sgml/release-10.sgml
index c72b4c931e..cf031e6ae3 100644
--- a/doc/src/sgml/release-10.sgml
+++ b/doc/src/sgml/release-10.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-10.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-10-6">
+<section>
+ <title>Release 10</title>
+ <section id="release-10-6">
   <title>Release 10.6</title>
 
   <formalpara>
@@ -15,7 +17,7 @@
    <xref linkend="release-10"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 10.6</title>
 
    <para>
@@ -31,9 +33,9 @@
     Also, if you are upgrading from a version earlier than 10.4,
     see <xref linkend="release-10-4"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1338,10 +1340,10 @@ Branch: REL9_3_STABLE [08aad3c81] 2018-09-30 16:24:56 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-10-5">
+ <section id="release-10-5">
   <title>Release 10.5</title>
 
   <formalpara>
@@ -1355,7 +1357,7 @@ Branch: REL9_3_STABLE [08aad3c81] 2018-09-30 16:24:56 -0400
    <xref linkend="release-10"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 10.5</title>
 
    <para>
@@ -1366,9 +1368,9 @@ Branch: REL9_3_STABLE [08aad3c81] 2018-09-30 16:24:56 -0400
     However, if you are upgrading from a version earlier than 10.4,
     see <xref linkend="release-10-4"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2407,10 +2409,10 @@ Branch: REL9_3_STABLE [3f36e4fc5] 2018-05-09 13:56:06 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-10-4">
+ <section id="release-10-4">
   <title>Release 10.4</title>
 
   <formalpara>
@@ -2424,7 +2426,7 @@ Branch: REL9_3_STABLE [3f36e4fc5] 2018-05-09 13:56:06 -0400
    <xref linkend="release-10"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 10.4</title>
 
    <para>
@@ -2446,9 +2448,9 @@ Branch: REL9_3_STABLE [3f36e4fc5] 2018-05-09 13:56:06 -0400
     Also, if you are upgrading from a version earlier than 10.3,
     see <xref linkend="release-10-3"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3523,10 +3525,10 @@ Branch: REL9_3_STABLE [adcd0c2be] 2018-04-29 15:50:50 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-10-3">
+ <section id="release-10-3">
   <title>Release 10.3</title>
 
   <formalpara>
@@ -3540,7 +3542,7 @@ Branch: REL9_3_STABLE [adcd0c2be] 2018-04-29 15:50:50 -0400
    <xref linkend="release-10"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 10.3</title>
 
    <para>
@@ -3567,9 +3569,9 @@ Branch: REL9_3_STABLE [adcd0c2be] 2018-04-29 15:50:50 -0400
     Also, if you are upgrading from a version earlier than 10.2,
     see <xref linkend="release-10-2"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3850,10 +3852,10 @@ Branch: REL9_6_STABLE [83fce670e] 2018-02-22 12:58:43 -0800
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-10-2">
+ <section id="release-10-2">
   <title>Release 10.2</title>
 
   <formalpara>
@@ -3867,7 +3869,7 @@ Branch: REL9_6_STABLE [83fce670e] 2018-02-22 12:58:43 -0800
    <xref linkend="release-10"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 10.2</title>
 
    <para>
@@ -3884,9 +3886,9 @@ Branch: REL9_6_STABLE [83fce670e] 2018-02-22 12:58:43 -0800
     Also, if you are upgrading from a version earlier than 10.1,
     see <xref linkend="release-10-1"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5062,10 +5064,10 @@ Branch: REL9_3_STABLE [e5e2cc6f8] 2018-01-27 16:43:00 -0500
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-10-1">
+ <section id="release-10-1">
   <title>Release 10.1</title>
 
   <formalpara>
@@ -5079,7 +5081,7 @@ Branch: REL9_3_STABLE [e5e2cc6f8] 2018-01-27 16:43:00 -0500
    <xref linkend="release-10"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 10.1</title>
 
    <para>
@@ -5089,9 +5091,9 @@ Branch: REL9_3_STABLE [e5e2cc6f8] 2018-01-27 16:43:00 -0500
    <para>
     However, if you use BRIN indexes, see the fourth changelog entry below.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5804,10 +5806,10 @@ Branch: REL_10_STABLE [5159626af] 2017-11-03 14:14:16 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-10">
+ <section id="release-10">
   <title>Release 10</title>
 
   <formalpara>
@@ -5815,7 +5817,7 @@ Branch: REL_10_STABLE [5159626af] 2017-11-03 14:14:16 -0400
    <para>2017-10-05</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -5838,9 +5840,9 @@ Branch: REL_10_STABLE [5159626af] 2017-11-03 14:14:16 -0400
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
 
   <title>Migration to Version 10</title>
 
@@ -6374,9 +6376,9 @@ Branch: REL_10_STABLE [5159626af] 2017-11-03 14:14:16 -0400
 
    </itemizedlist>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -6385,10 +6387,10 @@ Branch: REL_10_STABLE [5159626af] 2017-11-03 14:14:16 -0400
     release.
    </para>
 
-   <sect3>
+   <section>
     <title>Server</title>
 
-    <sect4>
+    <section>
      <title>Parallel Queries</title>
 
      <itemizedlist>
@@ -6494,9 +6496,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Indexes</title>
 
      <itemizedlist>
@@ -6610,9 +6612,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
 
      <title>Locking</title>
 
@@ -6654,9 +6656,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Optimizer</title>
 
      <itemizedlist>
@@ -6701,9 +6703,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>General Performance</title>
 
      <itemizedlist>
@@ -6787,9 +6789,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Monitoring</title>
 
      <itemizedlist>
@@ -6840,7 +6842,7 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-     <sect5>
+     <section>
       <title>Logging</title>
 
       <itemizedlist>
@@ -6938,9 +6940,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
       </itemizedlist>
 
-     </sect5>
+     </section>
 
-     <sect5>
+     <section>
       <title><link linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link></title>
 
       <itemizedlist>
@@ -7007,10 +7009,10 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
       </itemizedlist>
 
-     </sect5>
-    </sect4>
+     </section>
+    </section>
 
-    <sect4>
+    <section>
      <title><acronym>Authentication</acronym></title>
 
      <itemizedlist>
@@ -7080,9 +7082,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Server Configuration</title>
 
      <itemizedlist>
@@ -7123,9 +7125,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Reliability</title>
 
      <itemizedlist>
@@ -7146,7 +7148,7 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-     <sect5>
+     <section>
       <title><link linkend="wal">Write-Ahead Log</link> (<acronym>WAL</acronym>)</title>
 
       <itemizedlist>
@@ -7195,13 +7197,13 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
       </itemizedlist>
 
-     </sect5>
+     </section>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Replication and Recovery</title>
 
     <itemizedlist>
@@ -7367,9 +7369,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
 
     <itemizedlist>
@@ -7404,9 +7406,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Commands</title>
 
     <itemizedlist>
@@ -7595,9 +7597,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
 
     <itemizedlist>
@@ -7715,9 +7717,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
 
     <itemizedlist>
@@ -7839,9 +7841,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server-Side Languages</title>
 
     <itemizedlist>
@@ -7878,7 +7880,7 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="pltcl">PL/Tcl</link></title>
 
      <itemizedlist>
@@ -7920,10 +7922,10 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
-   </sect3>
+    </section>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Interfaces</title>
 
     <itemizedlist>
@@ -8015,12 +8017,12 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Applications</title>
 
-    <sect4>
+    <section>
      <title><xref linkend="app-psql"/></title>
 
      <itemizedlist>
@@ -8159,9 +8161,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><xref linkend="pgbench"/></title>
 
      <itemizedlist>
@@ -8203,11 +8205,11 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Applications</title>
 
     <itemizedlist>
@@ -8257,7 +8259,7 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="app-pgdump"><application>pg_dump</application></link>,
      <link linkend="app-pg-dumpall"><application>pg_dumpall</application></link>,
      <link linkend="app-pgrestore"><application>pg_restore</application></link></title>
@@ -8336,9 +8338,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
 
     <title><xref linkend="app-pgbasebackup"/></title>
 
@@ -8410,9 +8412,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><application><xref linkend="app-pg-ctl"/></application></title>
 
      <itemizedlist>
@@ -8501,10 +8503,10 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
      </itemizedlist>
 
-    </sect4>
-   </sect3>
+    </section>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
 
     <itemizedlist>
@@ -8781,9 +8783,9 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Additional Modules</title>
 
     <itemizedlist>
@@ -8986,11 +8988,11 @@ This was disabled in the PG 9.6 branch so there is no commit here.
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
+  </section>
 
-  <sect2 id="release-10-acknowledgements">
+  <section id="release-10-acknowledgements">
    <title>Acknowledgments</title>
 
    <para>
@@ -9325,6 +9327,7 @@ This was disabled in the PG 9.6 branch so there is no commit here.
     <member>Zhen Ming Yang</member>
     <member>Zhou Digoal</member>
    </simplelist>
-  </sect2>
+  </section>
 
- </sect1>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-11.sgml b/doc/src/sgml/release-11.sgml
index 09b80b8af5..b31a623fda 100644
--- a/doc/src/sgml/release-11.sgml
+++ b/doc/src/sgml/release-11.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-11.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-11-1">
+<section>
+ <title>Release 11</title>
+ <section id="release-11-1">
   <title>Release 11.1</title>
 
   <formalpara>
@@ -15,7 +17,7 @@
    <xref linkend="release-11"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 11.1</title>
 
    <para>
@@ -26,9 +28,9 @@
     However, if you use the <filename>pg_stat_statements</filename> extension,
     see the changelog entry below about that.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -495,10 +497,10 @@ Branch: REL9_3_STABLE [84261eb10] 2018-10-19 17:02:26 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-11">
+ <section id="release-11">
   <title>Release 11</title>
 
   <formalpara>
@@ -506,7 +508,7 @@ Branch: REL9_3_STABLE [84261eb10] 2018-10-19 17:02:26 -0400
    <para>2018-10-18</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -626,9 +628,9 @@ Branch: REL9_3_STABLE [84261eb10] 2018-10-19 17:02:26 -0400
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
 
   <title>Migration to Version 11</title>
 
@@ -1052,9 +1054,9 @@ Branch: REL9_3_STABLE [84261eb10] 2018-10-19 17:02:26 -0400
 
    </itemizedlist>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -1063,10 +1065,10 @@ Branch: REL9_3_STABLE [84261eb10] 2018-10-19 17:02:26 -0400
     release.
    </para>
 
-   <sect3>
+   <section>
     <title>Server</title>
 
-    <sect4>
+    <section>
      <title>Partitioning</title>
 
      <itemizedlist>
@@ -1280,9 +1282,9 @@ Branch: REL9_3_STABLE [84261eb10] 2018-10-19 17:02:26 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Parallel Queries</title>
 
      <itemizedlist>
@@ -1420,9 +1422,9 @@ same commits as above
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Indexes</title>
 
      <itemizedlist>
@@ -1490,7 +1492,7 @@ same commits as above
 
      </itemizedlist>
 
-     <sect5>
+     <section>
       <title><link linkend="spgist">SP-Gist</link></title>
 
       <itemizedlist>
@@ -1537,11 +1539,11 @@ same commits as above
 
       </itemizedlist>
 
-     </sect5>
+     </section>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Optimizer</title>
 
      <itemizedlist>
@@ -1627,9 +1629,9 @@ same commits as above
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>General Performance</title>
 
      <itemizedlist>
@@ -1766,9 +1768,9 @@ same commits as above
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Monitoring</title>
 
      <itemizedlist>
@@ -1820,7 +1822,7 @@ same commits as above
 
      </itemizedlist>
 
-     <sect5>
+     <section>
       <title><link linkend="infoschema-tables">Information Schema</link></title>
 
       <itemizedlist>
@@ -1850,10 +1852,10 @@ same commits as above
 
       </itemizedlist>
 
-     </sect5>
-    </sect4>
+     </section>
+    </section>
 
-    <sect4>
+    <section>
      <title><acronym>Authentication</acronym></title>
 
      <itemizedlist>
@@ -1909,9 +1911,9 @@ same commits as above
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Permissions</title>
 
      <itemizedlist>
@@ -2017,9 +2019,9 @@ same commits as above
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Server Configuration</title>
 
      <itemizedlist>
@@ -2084,9 +2086,9 @@ same commits as above
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="wal">Write-Ahead Log</link> (<acronym>WAL</acronym>)</title>
 
      <itemizedlist>
@@ -2136,11 +2138,11 @@ same commits as above
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Base Backup and Streaming Replication</title>
 
     <itemizedlist>
@@ -2245,9 +2247,9 @@ same commits as above
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Commands</title>
 
     <itemizedlist>
@@ -2351,9 +2353,9 @@ same commits as above
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
 
     <itemizedlist>
@@ -2406,9 +2408,9 @@ same commits as above
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
 
     <itemizedlist>
@@ -2512,9 +2514,9 @@ same commits as above
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server-Side Languages</title>
 
     <itemizedlist>
@@ -2630,9 +2632,9 @@ same commits as above
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Interfaces</title>
 
     <itemizedlist>
@@ -2688,12 +2690,12 @@ same commits as above
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Applications</title>
 
-    <sect4>
+    <section>
      <title><xref linkend="app-psql"/></title>
 
      <itemizedlist>
@@ -2863,9 +2865,9 @@ same commits as above
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="pgbench"><application>pgbench</application></link></title>
 
      <itemizedlist>
@@ -2976,11 +2978,11 @@ same commits as above
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Applications</title>
 
     <itemizedlist>
@@ -3131,7 +3133,7 @@ same commits as above
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="app-pgdump"><application>pg_dump</application></link>,
      <link linkend="app-pg-dumpall"><application>pg_dumpall</application></link>,
      <link linkend="app-pgrestore"><application>pg_restore</application></link></title>
@@ -3194,11 +3196,11 @@ same commits as above
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
 
     <itemizedlist>
@@ -3436,9 +3438,9 @@ same commits as above
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Additional Modules</title>
 
     <itemizedlist>
@@ -3629,11 +3631,11 @@ same commits as above
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
+  </section>
 
-  <sect2 id="release-11-acknowledgements">
+  <section id="release-11-acknowledgements">
    <title>Acknowledgments</title>
 
    <para>
@@ -3957,6 +3959,7 @@ same commits as above
     <member>Yves Goergen</member>
     <member>Zhou Digoal</member>
    </simplelist>
-  </sect2>
+  </section>
 
- </sect1>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-12.sgml b/doc/src/sgml/release-12.sgml
index b06fef287d..480ea53a8c 100644
--- a/doc/src/sgml/release-12.sgml
+++ b/doc/src/sgml/release-12.sgml
@@ -1,11 +1,14 @@
 <!-- doc/src/sgml/release-12.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-12">
+<section>
+ <title>Release 12</title>
+ <section id="release-12">
   <title>Release 12</title>
 
   <para>JIT is enabled by default in this release.  It was disabled by
   default in PG 11, so we document is enablement here.
   </para>
 
- </sect1>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-7.4.sgml b/doc/src/sgml/release-7.4.sgml
index a67945a42b..c9c45ec4c7 100644
--- a/doc/src/sgml/release-7.4.sgml
+++ b/doc/src/sgml/release-7.4.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-7.4.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-7-4-30">
+<section>
+ <title>Release 7.4</title>
+ <section id="release-7-4-30">
   <title>Release 7.4.30</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.30</title>
 
    <para>
@@ -30,9 +32,9 @@
     see <xref linkend="release-7-4-26"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -132,10 +134,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-29">
+ <section id="release-7-4-29">
   <title>Release 7.4.29</title>
 
   <formalpara>
@@ -155,7 +157,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.29</title>
 
    <para>
@@ -164,9 +166,9 @@
     see <xref linkend="release-7-4-26"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -276,10 +278,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-28">
+ <section id="release-7-4-28">
   <title>Release 7.4.28</title>
 
   <formalpara>
@@ -299,7 +301,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.28</title>
 
    <para>
@@ -308,9 +310,9 @@
     see <xref linkend="release-7-4-26"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -395,10 +397,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-27">
+ <section id="release-7-4-27">
   <title>Release 7.4.27</title>
 
   <formalpara>
@@ -412,7 +414,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.27</title>
 
    <para>
@@ -421,9 +423,9 @@
     see <xref linkend="release-7-4-26"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -515,10 +517,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-26">
+ <section id="release-7-4-26">
   <title>Release 7.4.26</title>
 
   <formalpara>
@@ -532,7 +534,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.26</title>
 
    <para>
@@ -543,9 +545,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -645,10 +647,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-25">
+ <section id="release-7-4-25">
   <title>Release 7.4.25</title>
 
   <formalpara>
@@ -662,7 +664,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.25</title>
 
    <para>
@@ -671,9 +673,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -725,10 +727,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-24">
+ <section id="release-7-4-24">
   <title>Release 7.4.24</title>
 
   <formalpara>
@@ -742,7 +744,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.24</title>
 
    <para>
@@ -751,9 +753,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -811,10 +813,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-23">
+ <section id="release-7-4-23">
   <title>Release 7.4.23</title>
 
   <formalpara>
@@ -828,7 +830,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.23</title>
 
    <para>
@@ -837,9 +839,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -895,10 +897,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-22">
+ <section id="release-7-4-22">
   <title>Release 7.4.22</title>
 
   <formalpara>
@@ -912,7 +914,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.22</title>
 
    <para>
@@ -921,9 +923,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -971,10 +973,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-21">
+ <section id="release-7-4-21">
   <title>Release 7.4.21</title>
 
   <formalpara>
@@ -988,7 +990,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.21</title>
 
    <para>
@@ -997,9 +999,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1025,10 +1027,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-20">
+ <section id="release-7-4-20">
   <title>Release 7.4.20</title>
 
   <formalpara>
@@ -1042,7 +1044,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.20</title>
 
    <para>
@@ -1051,9 +1053,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1170,10 +1172,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-19">
+ <section id="release-7-4-19">
   <title>Release 7.4.19</title>
 
   <formalpara>
@@ -1188,7 +1190,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.19</title>
 
    <para>
@@ -1197,9 +1199,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1324,10 +1326,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-18">
+ <section id="release-7-4-18">
   <title>Release 7.4.18</title>
 
   <formalpara>
@@ -1341,7 +1343,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.18</title>
 
    <para>
@@ -1350,9 +1352,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1400,10 +1402,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-17">
+ <section id="release-7-4-17">
   <title>Release 7.4.17</title>
 
   <formalpara>
@@ -1418,7 +1420,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.17</title>
 
    <para>
@@ -1427,9 +1429,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1471,10 +1473,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-16">
+ <section id="release-7-4-16">
   <title>Release 7.4.16</title>
 
   <formalpara>
@@ -1489,7 +1491,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.16</title>
 
    <para>
@@ -1498,9 +1500,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1542,10 +1544,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-15">
+ <section id="release-7-4-15">
   <title>Release 7.4.15</title>
 
   <formalpara>
@@ -1559,7 +1561,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.15</title>
 
    <para>
@@ -1568,9 +1570,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1631,10 +1633,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-14">
+ <section id="release-7-4-14">
   <title>Release 7.4.14</title>
 
   <formalpara>
@@ -1648,7 +1650,7 @@
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.14</title>
 
    <para>
@@ -1657,9 +1659,9 @@
     see <xref linkend="release-7-4-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -1678,10 +1680,10 @@ ANYARRAY</para></listitem>
 </para> </listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-13">
+ <section id="release-7-4-13">
   <title>Release 7.4.13</title>
 
   <formalpara>
@@ -1696,7 +1698,7 @@ ANYARRAY</para></listitem>
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.13</title>
 
    <para>
@@ -1716,9 +1718,9 @@ ANYARRAY</para></listitem>
     <function>PQescapeStringConn()</function>) to perform string escaping,
     rather than relying on <foreignphrase>ad hoc</foreignphrase> code to do it.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -1785,10 +1787,10 @@ Fuhr)</para></listitem>
 <listitem><para>Fix various minor memory leaks</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-12">
+ <section id="release-7-4-12">
   <title>Release 7.4.12</title>
 
   <formalpara>
@@ -1802,7 +1804,7 @@ Fuhr)</para></listitem>
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.12</title>
 
    <para>
@@ -1810,9 +1812,9 @@ Fuhr)</para></listitem>
     if you are upgrading from a version earlier than 7.4.11,
     see <xref linkend="release-7-4-11"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -1848,10 +1850,10 @@ and <function>isinf</function> during configure (Tom)</para></listitem>
 
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-11">
+ <section id="release-7-4-11">
   <title>Release 7.4.11</title>
 
   <formalpara>
@@ -1865,7 +1867,7 @@ and <function>isinf</function> during configure (Tom)</para></listitem>
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.11</title>
 
    <para>
@@ -1876,9 +1878,9 @@ and <function>isinf</function> during configure (Tom)</para></listitem>
     columns after updating, if you are affected by the locale or
     <application>plperl</application> issues described below.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -1915,10 +1917,10 @@ what's actually returned by the query (Joe)</para></listitem>
 
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-10">
+ <section id="release-7-4-10">
   <title>Release 7.4.10</title>
 
   <formalpara>
@@ -1932,7 +1934,7 @@ what's actually returned by the query (Joe)</para></listitem>
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.10</title>
 
    <para>
@@ -1940,9 +1942,9 @@ what's actually returned by the query (Joe)</para></listitem>
     if you are upgrading from a version earlier than 7.4.8,
     see <xref linkend="release-7-4-8"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -1968,10 +1970,10 @@ only supported with merge-joinable join conditions</quote>.</para></listitem>
 table has been dropped</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-9">
+ <section id="release-7-4-9">
   <title>Release 7.4.9</title>
 
   <formalpara>
@@ -1985,7 +1987,7 @@ table has been dropped</para></listitem>
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.9</title>
 
    <para>
@@ -1993,9 +1995,9 @@ table has been dropped</para></listitem>
     if you are upgrading from a version earlier than 7.4.8,
     see <xref linkend="release-7-4-8"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2037,10 +2039,10 @@ the variable is of pass-by-reference type</para></listitem>
 code</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-8">
+ <section id="release-7-4-8">
   <title>Release 7.4.8</title>
 
   <formalpara>
@@ -2055,7 +2057,7 @@ code</para></listitem>
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.8</title>
 
    <para>
@@ -2148,9 +2150,9 @@ VACUUM FREEZE;
 UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 </programlisting>
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2221,10 +2223,10 @@ holder of the lock released it within a very narrow window.
 <command>ALTER TABLE SET WITHOUT OIDS</command></para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-7">
+ <section id="release-7-4-7">
   <title>Release 7.4.7</title>
 
   <formalpara>
@@ -2239,15 +2241,15 @@ holder of the lock released it within a very narrow window.
    <xref linkend="release-7-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.7</title>
 
    <para>
     A dump/restore is not required for those running 7.4.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2281,10 +2283,10 @@ datestyles</para></listitem>
 GMT</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-6">
+ <section id="release-7-4-6">
   <title>Release 7.4.6</title>
 
   <formalpara>
@@ -2299,15 +2301,15 @@ GMT</para></listitem>
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.6</title>
 
    <para>
     A dump/restore is not required for those running 7.4.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2353,10 +2355,10 @@ This could arise in cases such as CLUSTER after ALTER TABLE DROP COLUMN.
 ECPG prepare statement</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-5">
+ <section id="release-7-4-5">
   <title>Release 7.4.5</title>
 
   <formalpara>
@@ -2371,15 +2373,15 @@ ECPG prepare statement</para></listitem>
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.5</title>
 
    <para>
     A dump/restore is not required for those running 7.4.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2391,10 +2393,10 @@ still worth a re-release.  The bug does not exist in pre-7.4 releases.
 </para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-4">
+ <section id="release-7-4-4">
   <title>Release 7.4.4</title>
 
   <formalpara>
@@ -2409,15 +2411,15 @@ still worth a re-release.  The bug does not exist in pre-7.4 releases.
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.4</title>
 
    <para>
     A dump/restore is not required for those running 7.4.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2443,10 +2445,10 @@ aggregate plan</para></listitem>
 <listitem><para>Translation updates (various contributors)</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-3">
+ <section id="release-7-4-3">
   <title>Release 7.4.3</title>
 
   <formalpara>
@@ -2461,15 +2463,15 @@ aggregate plan</para></listitem>
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.3</title>
 
    <para>
     A dump/restore is not required for those running 7.4.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2501,10 +2503,10 @@ names from outer query levels.
 <listitem><para>Numerous translation updates (various contributors)</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-2">
+ <section id="release-7-4-2">
   <title>Release 7.4.2</title>
 
   <formalpara>
@@ -2519,7 +2521,7 @@ names from outer query levels.
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.2</title>
 
    <para>
@@ -2603,9 +2605,9 @@ VACUUM FREEZE;
 UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 </programlisting>
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <para>
@@ -2644,10 +2646,10 @@ inconveniences associated with the <literal>i/I</literal> problem.</para></listi
 <listitem><para>Various JDBC fixes</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-4-1">
+ <section id="release-7-4-1">
   <title>Release 7.4.1</title>
 
   <formalpara>
@@ -2662,7 +2664,7 @@ inconveniences associated with the <literal>i/I</literal> problem.</para></listi
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.4.1</title>
 
    <para>
@@ -2685,9 +2687,9 @@ DROP SCHEMA information_schema CASCADE;
     Substitute your installation path in the second command.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2758,10 +2760,10 @@ DROP SCHEMA information_schema CASCADE;
 <listitem><para>Fix local ident authentication on FreeBSD (Tom)</para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
-<sect1 id="release-7-4">
+<section id="release-7-4">
  <title>Release 7.4</title>
 
  <formalpara>
@@ -2769,7 +2771,7 @@ DROP SCHEMA information_schema CASCADE;
   <para>2003-11-17</para>
  </formalpara>
 
- <sect2>
+ <section>
   <title>Overview</title>
 
   <para>
@@ -3040,9 +3042,9 @@ DROP SCHEMA information_schema CASCADE;
    </varlistentry>
 
   </variablelist>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Migration to Version 7.4</title>
 
   <para>
@@ -3194,9 +3196,9 @@ DROP SCHEMA information_schema CASCADE;
    </listitem>
 
   </itemizedlist>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
   <para>
@@ -3204,7 +3206,7 @@ DROP SCHEMA information_schema CASCADE;
    release 7.4 and the previous major release.
   </para>
 
- <sect3>
+ <section>
   <title>Server Operation Changes</title>
 
   <itemizedlist>
@@ -3301,9 +3303,9 @@ DROP SCHEMA information_schema CASCADE;
    <listitem><para>Remove autocommit server setting; move to client applications (Tom)</para></listitem>
    <listitem><para>New error message wording, error codes, and three levels of error detail (Tom, Joe, Peter)</para></listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Performance Improvements</title>
 
   <itemizedlist>
@@ -3483,9 +3485,9 @@ DROP SCHEMA information_schema CASCADE;
     </para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Server Configuration Changes</title>
 
   <itemizedlist>
@@ -3641,9 +3643,9 @@ DROP SCHEMA information_schema CASCADE;
     </para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Query Changes</title>
 
   <itemizedlist>
@@ -3703,9 +3705,9 @@ DROP SCHEMA information_schema CASCADE;
     <para>Implement <literal>CREATE TABLE AS EXECUTE</literal> (Neil, Peter)</para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Object Manipulation Changes</title>
 
   <itemizedlist>
@@ -3801,9 +3803,9 @@ DROP SCHEMA information_schema CASCADE;
     </para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Utility Command Changes</title>
 
   <itemizedlist>
@@ -3981,9 +3983,9 @@ DROP SCHEMA information_schema CASCADE;
     </para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Data Type and Function Changes</title>
 
   <itemizedlist>
@@ -4220,9 +4222,9 @@ DROP SCHEMA information_schema CASCADE;
     </para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Server-Side Language Changes</title>
 
   <itemizedlist>
@@ -4294,9 +4296,9 @@ DROP SCHEMA information_schema CASCADE;
     </para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>psql Changes</title>
 
   <itemizedlist>
@@ -4353,9 +4355,9 @@ DROP SCHEMA information_schema CASCADE;
    <listitem><para>New prompt escape sequence <literal>%x</literal> to show transaction status (Tom)</para></listitem>
    <listitem><para>Long options for <application>psql</application> are now available on all platforms</para></listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>pg_dump Changes</title>
 
   <itemizedlist>
@@ -4407,9 +4409,9 @@ DROP SCHEMA information_schema CASCADE;
     </para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>libpq Changes</title>
 
   <itemizedlist>
@@ -4500,9 +4502,9 @@ DROP SCHEMA information_schema CASCADE;
      </para>
     </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>JDBC Changes</title>
 
   <itemizedlist>
@@ -4512,9 +4514,9 @@ DROP SCHEMA information_schema CASCADE;
    <listitem><para>Handle schema names in result sets (Paul Sorenson)</para></listitem>
    <listitem><para>Add refcursor support (Nic Ferrier)</para></listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Miscellaneous Interface Changes</title>
 
   <itemizedlist>
@@ -4549,9 +4551,9 @@ DROP SCHEMA information_schema CASCADE;
     <para>Moved Python client PyGreSQL to <ulink url="http://www.pygresql.org"></ulink> (Marc)</para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Source Code Changes</title>
 
   <itemizedlist>
@@ -4588,9 +4590,9 @@ DROP SCHEMA information_schema CASCADE;
     </para>
    </listitem>
   </itemizedlist>
- </sect3>
+ </section>
 
- <sect3>
+ <section>
   <title>Contrib Changes</title>
 
   <itemizedlist>
@@ -4617,6 +4619,7 @@ DROP SCHEMA information_schema CASCADE;
    <listitem><para>Fix dbase <option>-s</option> option and improve non-ASCII handling (Thomas Behr, M&aacute;rcio Smiderle)</para></listitem>
    <listitem><para>Remove array module because features now included by default (Joe)</para></listitem>
   </itemizedlist>
- </sect3>
- </sect2>
-</sect1>
+ </section>
+ </section>
+</section>
+</section>
diff --git a/doc/src/sgml/release-8.0.sgml b/doc/src/sgml/release-8.0.sgml
index 6171e0d1ee..9efc545bd4 100644
--- a/doc/src/sgml/release-8.0.sgml
+++ b/doc/src/sgml/release-8.0.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-8.0.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-8-0-26">
+<section>
+ <title>Release 8.0</title>
+ <section id="release-8-0-26">
   <title>Release 8.0.26</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.26</title>
 
    <para>
@@ -30,9 +32,9 @@
     see <xref linkend="release-8-0-22"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -202,10 +204,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-25">
+ <section id="release-8-0-25">
   <title>Release 8.0.25</title>
 
   <formalpara>
@@ -225,7 +227,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.25</title>
 
    <para>
@@ -234,9 +236,9 @@
     see <xref linkend="release-8-0-22"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -362,10 +364,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-24">
+ <section id="release-8-0-24">
   <title>Release 8.0.24</title>
 
   <formalpara>
@@ -385,7 +387,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.24</title>
 
    <para>
@@ -394,9 +396,9 @@
     see <xref linkend="release-8-0-22"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -539,10 +541,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-23">
+ <section id="release-8-0-23">
   <title>Release 8.0.23</title>
 
   <formalpara>
@@ -556,7 +558,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.23</title>
 
    <para>
@@ -565,9 +567,9 @@
     see <xref linkend="release-8-0-22"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -694,10 +696,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-22">
+ <section id="release-8-0-22">
   <title>Release 8.0.22</title>
 
   <formalpara>
@@ -711,7 +713,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.22</title>
 
    <para>
@@ -722,9 +724,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -858,10 +860,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-21">
+ <section id="release-8-0-21">
   <title>Release 8.0.21</title>
 
   <formalpara>
@@ -875,7 +877,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.21</title>
 
    <para>
@@ -884,9 +886,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -938,10 +940,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-20">
+ <section id="release-8-0-20">
   <title>Release 8.0.20</title>
 
   <formalpara>
@@ -955,7 +957,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.20</title>
 
    <para>
@@ -964,9 +966,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1024,10 +1026,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-19">
+ <section id="release-8-0-19">
   <title>Release 8.0.19</title>
 
   <formalpara>
@@ -1041,7 +1043,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.19</title>
 
    <para>
@@ -1050,9 +1052,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1135,10 +1137,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-18">
+ <section id="release-8-0-18">
   <title>Release 8.0.18</title>
 
   <formalpara>
@@ -1152,7 +1154,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.18</title>
 
    <para>
@@ -1161,9 +1163,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1269,10 +1271,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-17">
+ <section id="release-8-0-17">
   <title>Release 8.0.17</title>
 
   <formalpara>
@@ -1286,7 +1288,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.17</title>
 
    <para>
@@ -1295,9 +1297,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1323,10 +1325,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-16">
+ <section id="release-8-0-16">
   <title>Release 8.0.16</title>
 
   <formalpara>
@@ -1340,7 +1342,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.16</title>
 
    <para>
@@ -1349,9 +1351,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1560,10 +1562,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-15">
+ <section id="release-8-0-15">
   <title>Release 8.0.15</title>
 
   <formalpara>
@@ -1587,7 +1589,7 @@
    be supported on other platforms.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.15</title>
 
    <para>
@@ -1596,9 +1598,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1776,10 +1778,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-14">
+ <section id="release-8-0-14">
   <title>Release 8.0.14</title>
 
   <formalpara>
@@ -1793,7 +1795,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.14</title>
 
    <para>
@@ -1802,9 +1804,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1884,10 +1886,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-13">
+ <section id="release-8-0-13">
   <title>Release 8.0.13</title>
 
   <formalpara>
@@ -1902,7 +1904,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.13</title>
 
    <para>
@@ -1911,9 +1913,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1961,10 +1963,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-12">
+ <section id="release-8-0-12">
   <title>Release 8.0.12</title>
 
   <formalpara>
@@ -1978,7 +1980,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.12</title>
 
    <para>
@@ -1987,9 +1989,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2003,10 +2005,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-11">
+ <section id="release-8-0-11">
   <title>Release 8.0.11</title>
 
   <formalpara>
@@ -2021,7 +2023,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.11</title>
 
    <para>
@@ -2030,9 +2032,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2074,10 +2076,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-10">
+ <section id="release-8-0-10">
   <title>Release 8.0.10</title>
 
   <formalpara>
@@ -2091,7 +2093,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.10</title>
 
    <para>
@@ -2100,9 +2102,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2193,10 +2195,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-9">
+ <section id="release-8-0-9">
   <title>Release 8.0.9</title>
 
   <formalpara>
@@ -2210,7 +2212,7 @@
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.9</title>
 
    <para>
@@ -2219,9 +2221,9 @@
     see <xref linkend="release-8-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2249,10 +2251,10 @@ Wieland)</para></listitem>
 <productname>Intel</productname> compilers (Tom)</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-8">
+ <section id="release-8-0-8">
   <title>Release 8.0.8</title>
 
   <formalpara>
@@ -2267,7 +2269,7 @@ Wieland)</para></listitem>
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.8</title>
 
    <para>
@@ -2287,9 +2289,9 @@ Wieland)</para></listitem>
     <function>PQescapeStringConn()</function>) to perform string escaping,
     rather than relying on <foreignphrase>ad hoc</foreignphrase> code to do it.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2363,10 +2365,10 @@ Fuhr)</para></listitem>
 (Robert Kinberg)</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-7">
+ <section id="release-8-0-7">
   <title>Release 8.0.7</title>
 
   <formalpara>
@@ -2380,7 +2382,7 @@ Fuhr)</para></listitem>
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.7</title>
 
    <para>
@@ -2388,9 +2390,9 @@ Fuhr)</para></listitem>
     if you are upgrading from a version earlier than 8.0.6,
     see <xref linkend="release-8-0-6"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2462,10 +2464,10 @@ and <function>isinf</function> during configure (Tom)</para></listitem>
 
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-6">
+ <section id="release-8-0-6">
   <title>Release 8.0.6</title>
 
   <formalpara>
@@ -2479,7 +2481,7 @@ and <function>isinf</function> during configure (Tom)</para></listitem>
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.6</title>
 
    <para>
@@ -2490,9 +2492,9 @@ and <function>isinf</function> during configure (Tom)</para></listitem>
     columns after updating, if you are affected by the locale or
     <application>plperl</application> issues described below.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2547,10 +2549,10 @@ what's actually returned by the query (Joe)</para></listitem>
 
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-5">
+ <section id="release-8-0-5">
   <title>Release 8.0.5</title>
 
   <formalpara>
@@ -2564,7 +2566,7 @@ what's actually returned by the query (Joe)</para></listitem>
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.5</title>
 
    <para>
@@ -2572,9 +2574,9 @@ what's actually returned by the query (Joe)</para></listitem>
     if you are upgrading from a version earlier than 8.0.3,
     see <xref linkend="release-8-0-3"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2629,10 +2631,10 @@ table has been dropped</para></listitem>
 to subquery results</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-4">
+ <section id="release-8-0-4">
   <title>Release 8.0.4</title>
 
   <formalpara>
@@ -2646,7 +2648,7 @@ to subquery results</para></listitem>
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.4</title>
 
    <para>
@@ -2654,9 +2656,9 @@ to subquery results</para></listitem>
     if you are upgrading from a version earlier than 8.0.3,
     see <xref linkend="release-8-0-3"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2726,10 +2728,10 @@ intervals over 2000 sec</para></listitem>
 code</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-3">
+ <section id="release-8-0-3">
   <title>Release 8.0.3</title>
 
   <formalpara>
@@ -2744,7 +2746,7 @@ code</para></listitem>
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.3</title>
 
    <para>
@@ -2786,9 +2788,9 @@ code</para></listitem>
     procedures shown in the <link linkend="release-7-4-8">7.4.8 release
     notes</link>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2846,10 +2848,10 @@ firing deferred triggers during transaction commit</para></listitem>
 data types</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-2">
+ <section id="release-8-0-2">
   <title>Release 8.0.2</title>
 
   <formalpara>
@@ -2863,7 +2865,7 @@ data types</para></listitem>
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.2</title>
 
    <para>
@@ -2873,9 +2875,9 @@ data types</para></listitem>
     necessary to re-link some user applications if they cannot
     find the properly-numbered shared library.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -3003,10 +3005,10 @@ returned the wrong year for the first few days of January in some years.
 addresses in <type>INET</type> data types (Tom)</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0-1">
+ <section id="release-8-0-1">
   <title>Release 8.0.1</title>
 
   <formalpara>
@@ -3021,15 +3023,15 @@ addresses in <type>INET</type> data types (Tom)</para></listitem>
    <xref linkend="release-8-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0.1</title>
 
    <para>
     A dump/restore is not required for those running 8.0.0.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -3072,10 +3074,10 @@ pg_dump/pg_restore</para></listitem>
 typedefs (Michael)</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-0">
+ <section id="release-8-0">
   <title>Release 8.0</title>
 
   <formalpara>
@@ -3083,7 +3085,7 @@ typedefs (Michael)</para></listitem>
    <para>2005-01-19</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -3238,9 +3240,9 @@ typedefs (Michael)</para></listitem>
     </varlistentry>
 
    </variablelist>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.0</title>
 
    <para>
@@ -3479,9 +3481,9 @@ typedefs (Michael)</para></listitem>
     </listitem>
 
    </itemizedlist>
-  </sect2>
+  </section>
 
- <sect2>
+ <section>
   <title>Deprecated Features</title>
 
   <para>
@@ -3525,9 +3527,9 @@ typedefs (Michael)</para></listitem>
     </listitem>
 
    </itemizedlist>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -3535,7 +3537,7 @@ typedefs (Michael)</para></listitem>
     release 8.0 and the previous major release.
    </para>
 
-   <sect3>
+   <section>
     <title>Performance Improvements</title>
     <itemizedlist>
 
@@ -3729,10 +3731,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Server Changes</title>
     <itemizedlist>
 
@@ -3948,10 +3950,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Query Changes</title>
     <itemizedlist>
 
@@ -4103,10 +4105,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Object Manipulation Changes</title>
     <itemizedlist>
 
@@ -4273,10 +4275,10 @@ typedefs (Michael)</para></listitem>
 
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Utility Command Changes</title>
     <itemizedlist>
 
@@ -4421,10 +4423,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Data Type and Function Changes</title>
     <itemizedlist>
 
@@ -4708,10 +4710,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Server-Side Language Changes</title>
     <itemizedlist>
 
@@ -4834,10 +4836,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title><application>psql</application> Changes</title>
     <itemizedlist>
 
@@ -4957,10 +4959,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title><application>pg_dump</application> Changes</title>
     <itemizedlist>
 
@@ -5035,10 +5037,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>libpq Changes</title>
     <itemizedlist>
 
@@ -5092,10 +5094,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Source Code Changes</title>
     <itemizedlist>
 
@@ -5333,10 +5335,10 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Contrib Changes</title>
     <itemizedlist>
 
@@ -5415,7 +5417,8 @@ typedefs (Michael)</para></listitem>
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-8.1.sgml b/doc/src/sgml/release-8.1.sgml
index 44a30892fd..bdfaf79871 100644
--- a/doc/src/sgml/release-8.1.sgml
+++ b/doc/src/sgml/release-8.1.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-8.1.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-8-1-23">
+<section>
+ <title>Release 8.1</title>
+ <section id="release-8-1-23">
   <title>Release 8.1.23</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.23</title>
 
    <para>
@@ -30,9 +32,9 @@
     see <xref linkend="release-8-1-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -217,10 +219,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-22">
+ <section id="release-8-1-22">
   <title>Release 8.1.22</title>
 
   <formalpara>
@@ -240,7 +242,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.22</title>
 
    <para>
@@ -249,9 +251,9 @@
     see <xref linkend="release-8-1-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -435,10 +437,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-21">
+ <section id="release-8-1-21">
   <title>Release 8.1.21</title>
 
   <formalpara>
@@ -452,7 +454,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.21</title>
 
    <para>
@@ -461,9 +463,9 @@
     see <xref linkend="release-8-1-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -589,10 +591,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-20">
+ <section id="release-8-1-20">
   <title>Release 8.1.20</title>
 
   <formalpara>
@@ -606,7 +608,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.20</title>
 
    <para>
@@ -615,9 +617,9 @@
     see <xref linkend="release-8-1-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -779,10 +781,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-19">
+ <section id="release-8-1-19">
   <title>Release 8.1.19</title>
 
   <formalpara>
@@ -796,7 +798,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.19</title>
 
    <para>
@@ -805,9 +807,9 @@
     see <xref linkend="release-8-1-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -960,10 +962,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-18">
+ <section id="release-8-1-18">
   <title>Release 8.1.18</title>
 
   <formalpara>
@@ -977,7 +979,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.18</title>
 
    <para>
@@ -988,9 +990,9 @@
     see <xref linkend="release-8-1-15"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1124,10 +1126,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-17">
+ <section id="release-8-1-17">
   <title>Release 8.1.17</title>
 
   <formalpara>
@@ -1141,7 +1143,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.17</title>
 
    <para>
@@ -1150,9 +1152,9 @@
     see <xref linkend="release-8-1-15"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1247,10 +1249,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-16">
+ <section id="release-8-1-16">
   <title>Release 8.1.16</title>
 
   <formalpara>
@@ -1264,7 +1266,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.16</title>
 
    <para>
@@ -1273,9 +1275,9 @@
     see <xref linkend="release-8-1-15"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1367,10 +1369,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-15">
+ <section id="release-8-1-15">
   <title>Release 8.1.15</title>
 
   <formalpara>
@@ -1384,7 +1386,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.15</title>
 
    <para>
@@ -1395,9 +1397,9 @@
     indexes after the upgrade.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1519,10 +1521,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-14">
+ <section id="release-8-1-14">
   <title>Release 8.1.14</title>
 
   <formalpara>
@@ -1536,7 +1538,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.14</title>
 
    <para>
@@ -1545,9 +1547,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1695,10 +1697,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-13">
+ <section id="release-8-1-13">
   <title>Release 8.1.13</title>
 
   <formalpara>
@@ -1712,7 +1714,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.13</title>
 
    <para>
@@ -1721,9 +1723,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1762,10 +1764,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-12">
+ <section id="release-8-1-12">
   <title>Release 8.1.12</title>
 
   <formalpara>
@@ -1779,7 +1781,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.12</title>
 
    <para>
@@ -1788,9 +1790,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2012,10 +2014,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-11">
+ <section id="release-8-1-11">
   <title>Release 8.1.11</title>
 
   <formalpara>
@@ -2039,7 +2041,7 @@
    be supported on other platforms.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.11</title>
 
    <para>
@@ -2048,9 +2050,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2264,10 +2266,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-10">
+ <section id="release-8-1-10">
   <title>Release 8.1.10</title>
 
   <formalpara>
@@ -2281,7 +2283,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.10</title>
 
    <para>
@@ -2290,9 +2292,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2385,10 +2387,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-9">
+ <section id="release-8-1-9">
   <title>Release 8.1.9</title>
 
   <formalpara>
@@ -2403,7 +2405,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.9</title>
 
    <para>
@@ -2412,9 +2414,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2476,10 +2478,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-8">
+ <section id="release-8-1-8">
   <title>Release 8.1.8</title>
 
   <formalpara>
@@ -2493,7 +2495,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.8</title>
 
    <para>
@@ -2502,9 +2504,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2518,10 +2520,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-7">
+ <section id="release-8-1-7">
   <title>Release 8.1.7</title>
 
   <formalpara>
@@ -2536,7 +2538,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.7</title>
 
    <para>
@@ -2545,9 +2547,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2620,10 +2622,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-6">
+ <section id="release-8-1-6">
   <title>Release 8.1.6</title>
 
   <formalpara>
@@ -2637,7 +2639,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.6</title>
 
    <para>
@@ -2646,9 +2648,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2770,10 +2772,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-5">
+ <section id="release-8-1-5">
   <title>Release 8.1.5</title>
 
   <formalpara>
@@ -2787,7 +2789,7 @@
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.5</title>
 
    <para>
@@ -2796,9 +2798,9 @@
     see <xref linkend="release-8-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2847,10 +2849,10 @@ compilers (Hiroshi Saito)</para></listitem>
 <listitem><para>Fix rare bug in continuous archiving (Tom)</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-4">
+ <section id="release-8-1-4">
   <title>Release 8.1.4</title>
 
   <formalpara>
@@ -2865,7 +2867,7 @@ compilers (Hiroshi Saito)</para></listitem>
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.4</title>
 
    <para>
@@ -2885,9 +2887,9 @@ compilers (Hiroshi Saito)</para></listitem>
     <function>PQescapeStringConn()</function>) to perform string escaping,
     rather than relying on <foreignphrase>ad hoc</foreignphrase> code to do it.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -3001,10 +3003,10 @@ users and groups reasonably (only possible when dumping from a pre-8.1 server)
 documented (Tom)</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-3">
+ <section id="release-8-1-3">
   <title>Release 8.1.3</title>
 
   <formalpara>
@@ -3019,7 +3021,7 @@ documented (Tom)</para></listitem>
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.3</title>
 
    <para>
@@ -3027,9 +3029,9 @@ documented (Tom)</para></listitem>
     However, if you are upgrading from a version earlier than 8.1.2,
     see <xref linkend="release-8-1-2"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -3123,10 +3125,10 @@ creation (Tom)</para></listitem>
 
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-2">
+ <section id="release-8-1-2">
   <title>Release 8.1.2</title>
 
   <formalpara>
@@ -3140,7 +3142,7 @@ creation (Tom)</para></listitem>
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.2</title>
 
    <para>
@@ -3149,9 +3151,9 @@ creation (Tom)</para></listitem>
     columns after updating, if you are affected by the locale or
     <application>plperl</application> issues described below.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -3226,10 +3228,10 @@ what's actually returned by the query (Joe)</para></listitem>
 
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1-1">
+ <section id="release-8-1-1">
   <title>Release 8.1.1</title>
 
   <formalpara>
@@ -3243,15 +3245,15 @@ what's actually returned by the query (Joe)</para></listitem>
    <xref linkend="release-8-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1.1</title>
 
    <para>
     A dump/restore is not required for those running 8.1.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -3318,10 +3320,10 @@ DISTINCT query</para></listitem>
 <literal>UTF-8</literal> byte sequences (Paul Lindner)</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-1">
+ <section id="release-8-1">
   <title>Release 8.1</title>
 
   <formalpara>
@@ -3329,7 +3331,7 @@ DISTINCT query</para></listitem>
    <para>2005-11-08</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -3545,9 +3547,9 @@ DISTINCT query</para></listitem>
     </varlistentry>
 
    </variablelist>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.1</title>
 
    <para>
@@ -3845,9 +3847,9 @@ psql -t -f fixseq.sql db1 | psql -e db1
     </listitem>
 
    </itemizedlist>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Additional Changes</title>
 
    <para>
@@ -3856,7 +3858,7 @@ psql -t -f fixseq.sql db1 | psql -e db1
     previous major release.
    </para>
 
-   <sect3>
+   <section>
     <title>Performance Improvements</title>
     <itemizedlist>
 
@@ -3977,9 +3979,9 @@ psql -t -f fixseq.sql db1 | psql -e db1
       </para>
      </listitem>
     </itemizedlist>
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Changes</title>
     <itemizedlist>
 
@@ -4134,10 +4136,10 @@ psql -t -f fixseq.sql db1 | psql -e db1
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Query Changes</title>
     <itemizedlist>
 
@@ -4209,10 +4211,10 @@ psql -t -f fixseq.sql db1 | psql -e db1
       </para>
      </listitem>
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Object Manipulation Changes</title>
     <itemizedlist>
 
@@ -4264,10 +4266,10 @@ psql -t -f fixseq.sql db1 | psql -e db1
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Utility Command Changes</title>
     <itemizedlist>
 
@@ -4380,10 +4382,10 @@ psql -t -f fixseq.sql db1 | psql -e db1
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Data Type and Function Changes</title>
     <itemizedlist>
 
@@ -4669,10 +4671,10 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Encoding and Locale Changes</title>
     <itemizedlist>
 
@@ -4752,10 +4754,10 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>General Server-Side Language Changes</title>
     <itemizedlist>
 
@@ -4812,9 +4814,9 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>PL/pgSQL Server-Side Language Changes</title>
     <itemizedlist>
 
@@ -4904,10 +4906,10 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>PL/Perl Server-Side Language Changes</title>
     <itemizedlist>
 
@@ -4975,10 +4977,10 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title><application>psql</application> Changes</title>
     <itemizedlist>
 
@@ -5084,10 +5086,10 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title><application>pg_dump</application> Changes</title>
     <itemizedlist>
 
@@ -5152,10 +5154,10 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title><application>libpq</application> Changes</title>
     <itemizedlist>
 
@@ -5182,10 +5184,10 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
       </para>
      </listitem>
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Source Code Changes</title>
     <itemizedlist>
 
@@ -5327,10 +5329,10 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
       </para>
      </listitem>
     </itemizedlist>
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Contrib Changes</title>
     <itemizedlist>
 
@@ -5438,7 +5440,8 @@ SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';
      </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-8.2.sgml b/doc/src/sgml/release-8.2.sgml
index d87c5bbd46..f7c82df828 100644
--- a/doc/src/sgml/release-8.2.sgml
+++ b/doc/src/sgml/release-8.2.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-8.2.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-8-2-23">
+<section>
+ <title>Release 8.2</title>
+ <section id="release-8-2-23">
   <title>Release 8.2.23</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.23</title>
 
    <para>
@@ -40,9 +42,9 @@
     see <xref linkend="release-8-2-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -226,10 +228,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-22">
+ <section id="release-8-2-22">
   <title>Release 8.2.22</title>
 
   <formalpara>
@@ -249,7 +251,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.22</title>
 
    <para>
@@ -258,9 +260,9 @@
     see <xref linkend="release-8-2-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -533,10 +535,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-21">
+ <section id="release-8-2-21">
   <title>Release 8.2.21</title>
 
   <formalpara>
@@ -550,7 +552,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.21</title>
 
    <para>
@@ -559,9 +561,9 @@
     see <xref linkend="release-8-2-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -665,10 +667,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-20">
+ <section id="release-8-2-20">
   <title>Release 8.2.20</title>
 
   <formalpara>
@@ -682,7 +684,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.20</title>
 
    <para>
@@ -691,9 +693,9 @@
     see <xref linkend="release-8-2-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -797,10 +799,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-19">
+ <section id="release-8-2-19">
   <title>Release 8.2.19</title>
 
   <formalpara>
@@ -814,7 +816,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.19</title>
 
    <para>
@@ -823,9 +825,9 @@
     see <xref linkend="release-8-2-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1041,10 +1043,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-18">
+ <section id="release-8-2-18">
   <title>Release 8.2.18</title>
 
   <formalpara>
@@ -1058,7 +1060,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.18</title>
 
    <para>
@@ -1067,9 +1069,9 @@
     see <xref linkend="release-8-2-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1327,10 +1329,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-17">
+ <section id="release-8-2-17">
   <title>Release 8.2.17</title>
 
   <formalpara>
@@ -1344,7 +1346,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.17</title>
 
    <para>
@@ -1353,9 +1355,9 @@
     see <xref linkend="release-8-2-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1528,10 +1530,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-16">
+ <section id="release-8-2-16">
   <title>Release 8.2.16</title>
 
   <formalpara>
@@ -1545,7 +1547,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.16</title>
 
    <para>
@@ -1554,9 +1556,9 @@
     see <xref linkend="release-8-2-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1799,10 +1801,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-15">
+ <section id="release-8-2-15">
   <title>Release 8.2.15</title>
 
   <formalpara>
@@ -1816,7 +1818,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.15</title>
 
    <para>
@@ -1825,9 +1827,9 @@
     see <xref linkend="release-8-2-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2043,10 +2045,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-14">
+ <section id="release-8-2-14">
   <title>Release 8.2.14</title>
 
   <formalpara>
@@ -2060,7 +2062,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.14</title>
 
    <para>
@@ -2071,9 +2073,9 @@
     see <xref linkend="release-8-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2273,10 +2275,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-13">
+ <section id="release-8-2-13">
   <title>Release 8.2.13</title>
 
   <formalpara>
@@ -2290,7 +2292,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.13</title>
 
    <para>
@@ -2299,9 +2301,9 @@
     see <xref linkend="release-8-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2439,10 +2441,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-12">
+ <section id="release-8-2-12">
   <title>Release 8.2.12</title>
 
   <formalpara>
@@ -2456,7 +2458,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.12</title>
 
    <para>
@@ -2465,9 +2467,9 @@
     see <xref linkend="release-8-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2618,10 +2620,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-11">
+ <section id="release-8-2-11">
   <title>Release 8.2.11</title>
 
   <formalpara>
@@ -2635,7 +2637,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.11</title>
 
    <para>
@@ -2646,9 +2648,9 @@
     indexes after the upgrade.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2802,10 +2804,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-10">
+ <section id="release-8-2-10">
   <title>Release 8.2.10</title>
 
   <formalpara>
@@ -2819,7 +2821,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.10</title>
 
    <para>
@@ -2828,9 +2830,9 @@
     see <xref linkend="release-8-2-7"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3034,10 +3036,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-9">
+ <section id="release-8-2-9">
   <title>Release 8.2.9</title>
 
   <formalpara>
@@ -3051,7 +3053,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.9</title>
 
    <para>
@@ -3060,9 +3062,9 @@
     see <xref linkend="release-8-2-7"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3101,10 +3103,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-8">
+ <section id="release-8-2-8">
   <title>Release 8.2.8</title>
 
   <formalpara>
@@ -3118,7 +3120,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.8</title>
 
    <para>
@@ -3127,9 +3129,9 @@
     see <xref linkend="release-8-2-7"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3296,10 +3298,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-7">
+ <section id="release-8-2-7">
   <title>Release 8.2.7</title>
 
   <formalpara>
@@ -3313,7 +3315,7 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.7</title>
 
    <para>
@@ -3323,9 +3325,9 @@
     issue described below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3565,10 +3567,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-6">
+ <section id="release-8-2-6">
   <title>Release 8.2.6</title>
 
   <formalpara>
@@ -3583,16 +3585,16 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.6</title>
 
    <para>
     A dump/restore is not required for those running 8.2.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3856,10 +3858,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-5">
+ <section id="release-8-2-5">
   <title>Release 8.2.5</title>
 
   <formalpara>
@@ -3873,16 +3875,16 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.5</title>
 
    <para>
     A dump/restore is not required for those running 8.2.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4033,10 +4035,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-4">
+ <section id="release-8-2-4">
   <title>Release 8.2.4</title>
 
   <formalpara>
@@ -4051,16 +4053,16 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.4</title>
 
    <para>
     A dump/restore is not required for those running 8.2.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4177,10 +4179,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-3">
+ <section id="release-8-2-3">
   <title>Release 8.2.3</title>
 
   <formalpara>
@@ -4194,16 +4196,16 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.3</title>
 
    <para>
     A dump/restore is not required for those running 8.2.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4223,10 +4225,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-2">
+ <section id="release-8-2-2">
   <title>Release 8.2.2</title>
 
   <formalpara>
@@ -4241,16 +4243,16 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.2</title>
 
    <para>
     A dump/restore is not required for those running 8.2.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4381,10 +4383,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2-1">
+ <section id="release-8-2-1">
   <title>Release 8.2.1</title>
 
   <formalpara>
@@ -4398,16 +4400,16 @@
    <xref linkend="release-8-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2.1</title>
 
    <para>
     A dump/restore is not required for those running 8.2.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4516,10 +4518,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-2">
+ <section id="release-8-2">
   <title>Release 8.2</title>
 
   <formalpara>
@@ -4527,7 +4529,7 @@
    <para>2006-12-05</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -4639,9 +4641,9 @@
 
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.2</title>
 
    <para>
@@ -4967,9 +4969,9 @@
      </listitem>
 
    </itemizedlist>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -4978,7 +4980,7 @@
     the previous major release.
    </para>
 
-   <sect3>
+   <section>
     <title>Performance Improvements</title>
     <itemizedlist>
 
@@ -5152,9 +5154,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Changes</title>
     <itemizedlist>
 
@@ -5467,9 +5469,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Query Changes</title>
     <itemizedlist>
 
@@ -5684,9 +5686,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Manipulation Changes</title>
     <itemizedlist>
 
@@ -5868,9 +5870,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Command Changes</title>
     <itemizedlist>
 
@@ -5951,9 +5953,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Date/Time Changes</title>
     <itemizedlist>
 
@@ -6063,9 +6065,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Other Data Type and Function Changes</title>
     <itemizedlist>
 
@@ -6209,9 +6211,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>PL/pgSQL Server-Side Language Changes</title>
     <itemizedlist>
 
@@ -6258,9 +6260,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>PL/Perl Server-Side Language Changes</title>
     <itemizedlist>
 
@@ -6303,9 +6305,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>PL/Python Server-Side Language Changes</title>
     <itemizedlist>
 
@@ -6350,9 +6352,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="app-psql"><application>psql</application></link> Changes</title>
     <itemizedlist>
 
@@ -6458,9 +6460,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="app-pgdump"><application>pg_dump</application></link> Changes</title>
     <itemizedlist>
 
@@ -6505,9 +6507,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="libpq"><application>libpq</application></link> Changes</title>
     <itemizedlist>
 
@@ -6574,9 +6576,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="ecpg"><application>ecpg</application></link> Changes</title>
     <itemizedlist>
 
@@ -6608,9 +6610,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><application>Windows</application> Port</title>
     <itemizedlist>
 
@@ -6662,9 +6664,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code Changes</title>
     <itemizedlist>
 
@@ -6877,9 +6879,9 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Contrib Changes</title>
     <itemizedlist>
 
@@ -7071,7 +7073,8 @@
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-8.3.sgml b/doc/src/sgml/release-8.3.sgml
index 021922966b..b856624aaa 100644
--- a/doc/src/sgml/release-8.3.sgml
+++ b/doc/src/sgml/release-8.3.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-8.3.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-8-3-23">
+<section>
+ <title>Release 8.3</title>
+ <section id="release-8-3-23">
   <title>Release 8.3.23</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.23</title>
 
    <para>
@@ -33,9 +35,9 @@
     see <xref linkend="release-8-3-17"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -167,10 +169,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-22">
+ <section id="release-8-3-22">
   <title>Release 8.3.22</title>
 
   <formalpara>
@@ -190,7 +192,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.22</title>
 
    <para>
@@ -202,9 +204,9 @@
     see <xref linkend="release-8-3-17"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -463,10 +465,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-21">
+ <section id="release-8-3-21">
   <title>Release 8.3.21</title>
 
   <formalpara>
@@ -486,7 +488,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.21</title>
 
    <para>
@@ -498,9 +500,9 @@
     see <xref linkend="release-8-3-17"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -573,10 +575,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-20">
+ <section id="release-8-3-20">
   <title>Release 8.3.20</title>
 
   <formalpara>
@@ -596,7 +598,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.20</title>
 
    <para>
@@ -608,9 +610,9 @@
     see <xref linkend="release-8-3-17"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -796,10 +798,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-19">
+ <section id="release-8-3-19">
   <title>Release 8.3.19</title>
 
   <formalpara>
@@ -813,7 +815,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.19</title>
 
    <para>
@@ -825,9 +827,9 @@
     see <xref linkend="release-8-3-17"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1025,10 +1027,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-18">
+ <section id="release-8-3-18">
   <title>Release 8.3.18</title>
 
   <formalpara>
@@ -1042,7 +1044,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.18</title>
 
    <para>
@@ -1054,9 +1056,9 @@
     see <xref linkend="release-8-3-17"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1313,10 +1315,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-17">
+ <section id="release-8-3-17">
   <title>Release 8.3.17</title>
 
   <formalpara>
@@ -1330,7 +1332,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.17</title>
 
    <para>
@@ -1349,9 +1351,9 @@
     see <xref linkend="release-8-3-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1580,10 +1582,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-16">
+ <section id="release-8-3-16">
   <title>Release 8.3.16</title>
 
   <formalpara>
@@ -1597,7 +1599,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.16</title>
 
    <para>
@@ -1606,9 +1608,9 @@
     see <xref linkend="release-8-3-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1951,10 +1953,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-15">
+ <section id="release-8-3-15">
   <title>Release 8.3.15</title>
 
   <formalpara>
@@ -1968,7 +1970,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.15</title>
 
    <para>
@@ -1977,9 +1979,9 @@
     see <xref linkend="release-8-3-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2114,10 +2116,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-14">
+ <section id="release-8-3-14">
   <title>Release 8.3.14</title>
 
   <formalpara>
@@ -2131,7 +2133,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.14</title>
 
    <para>
@@ -2140,9 +2142,9 @@
     see <xref linkend="release-8-3-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2246,10 +2248,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-13">
+ <section id="release-8-3-13">
   <title>Release 8.3.13</title>
 
   <formalpara>
@@ -2263,7 +2265,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.13</title>
 
    <para>
@@ -2272,9 +2274,9 @@
     see <xref linkend="release-8-3-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2524,10 +2526,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-12">
+ <section id="release-8-3-12">
   <title>Release 8.3.12</title>
 
   <formalpara>
@@ -2541,7 +2543,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.12</title>
 
    <para>
@@ -2550,9 +2552,9 @@
     see <xref linkend="release-8-3-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2887,10 +2889,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-11">
+ <section id="release-8-3-11">
   <title>Release 8.3.11</title>
 
   <formalpara>
@@ -2904,7 +2906,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.11</title>
 
    <para>
@@ -2913,9 +2915,9 @@
     see <xref linkend="release-8-3-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3116,10 +3118,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-10">
+ <section id="release-8-3-10">
   <title>Release 8.3.10</title>
 
   <formalpara>
@@ -3133,7 +3135,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.10</title>
 
    <para>
@@ -3142,9 +3144,9 @@
     see <xref linkend="release-8-3-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3443,10 +3445,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-9">
+ <section id="release-8-3-9">
   <title>Release 8.3.9</title>
 
   <formalpara>
@@ -3460,7 +3462,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.9</title>
 
    <para>
@@ -3469,9 +3471,9 @@
     see <xref linkend="release-8-3-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3776,10 +3778,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-8">
+ <section id="release-8-3-8">
   <title>Release 8.3.8</title>
 
   <formalpara>
@@ -3793,7 +3795,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.8</title>
 
    <para>
@@ -3804,9 +3806,9 @@
     see <xref linkend="release-8-3-5"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4066,10 +4068,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-7">
+ <section id="release-8-3-7">
   <title>Release 8.3.7</title>
 
   <formalpara>
@@ -4083,7 +4085,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.7</title>
 
    <para>
@@ -4092,9 +4094,9 @@
     see <xref linkend="release-8-3-5"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4289,10 +4291,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-6">
+ <section id="release-8-3-6">
   <title>Release 8.3.6</title>
 
   <formalpara>
@@ -4306,7 +4308,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.6</title>
 
    <para>
@@ -4315,9 +4317,9 @@
     see <xref linkend="release-8-3-5"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4583,10 +4585,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-5">
+ <section id="release-8-3-5">
   <title>Release 8.3.5</title>
 
   <formalpara>
@@ -4600,7 +4602,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.5</title>
 
    <para>
@@ -4611,9 +4613,9 @@
     indexes after the upgrade.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4838,10 +4840,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-4">
+ <section id="release-8-3-4">
   <title>Release 8.3.4</title>
 
   <formalpara>
@@ -4855,7 +4857,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.4</title>
 
    <para>
@@ -4864,9 +4866,9 @@
     see <xref linkend="release-8-3-1"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5192,10 +5194,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-3">
+ <section id="release-8-3-3">
   <title>Release 8.3.3</title>
 
   <formalpara>
@@ -5209,7 +5211,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.3</title>
 
    <para>
@@ -5218,9 +5220,9 @@
     see <xref linkend="release-8-3-1"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5259,10 +5261,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-2">
+ <section id="release-8-3-2">
   <title>Release 8.3.2</title>
 
   <formalpara>
@@ -5276,7 +5278,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.2</title>
 
    <para>
@@ -5285,9 +5287,9 @@
     see <xref linkend="release-8-3-1"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5624,10 +5626,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3-1">
+ <section id="release-8-3-1">
   <title>Release 8.3.1</title>
 
   <formalpara>
@@ -5641,7 +5643,7 @@
    <xref linkend="release-8-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3.1</title>
 
    <para>
@@ -5651,9 +5653,9 @@
     issue described below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5937,10 +5939,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-3">
+ <section id="release-8-3">
   <title>Release 8.3</title>
 
   <formalpara>
@@ -5948,7 +5950,7 @@
    <para>2008-02-04</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -6126,9 +6128,9 @@
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.3</title>
 
    <para>
@@ -6141,7 +6143,7 @@
     Observe the following incompatibilities:
    </para>
 
-   <sect3>
+   <section>
     <title>General</title>
     <itemizedlist>
 
@@ -6368,9 +6370,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-    </sect3>
+    </section>
 
-    <sect3>
+    <section>
      <title>Configuration Parameters</title>
 
     <itemizedlist>
@@ -6433,10 +6435,10 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-    </sect3>
+    </section>
 
 
-    <sect3>
+    <section>
      <title>Character Encodings</title>
 
     <itemizedlist>
@@ -6549,11 +6551,11 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -6562,7 +6564,7 @@ current_date &lt; 2017-11-17
     the previous major release.
    </para>
 
-   <sect3>
+   <section>
     <title>Performance</title>
     <itemizedlist>
 
@@ -6766,9 +6768,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server</title>
     <itemizedlist>
 
@@ -6909,9 +6911,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Monitoring</title>
     <itemizedlist>
 
@@ -7062,9 +7064,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Authentication</title>
     <itemizedlist>
 
@@ -7107,9 +7109,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Write-Ahead Log (<acronym>WAL</acronym>) and Continuous Archiving</title>
     <itemizedlist>
 
@@ -7155,9 +7157,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
     <itemizedlist>
 
@@ -7289,9 +7291,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Manipulation</title>
     <itemizedlist>
 
@@ -7404,9 +7406,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Commands</title>
     <itemizedlist>
 
@@ -7506,9 +7508,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
     <itemizedlist>
 
@@ -7583,9 +7585,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
     <itemizedlist>
 
@@ -7721,9 +7723,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>PL/pgSQL Server-Side Language</title>
     <itemizedlist>
 
@@ -7807,9 +7809,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Other Server-Side Languages</title>
     <itemizedlist>
 
@@ -7864,9 +7866,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="app-psql"><application>psql</application></link></title>
     <itemizedlist>
 
@@ -7953,9 +7955,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="app-pgdump"><application>pg_dump</application></link></title>
     <itemizedlist>
 
@@ -8008,9 +8010,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Other Client Applications</title>
     <itemizedlist>
 
@@ -8073,9 +8075,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="libpq"><application>libpq</application></link></title>
     <itemizedlist>
 
@@ -8144,9 +8146,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="ecpg"><application>ecpg</application></link></title>
     <itemizedlist>
 
@@ -8180,9 +8182,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><application>Windows</application> Port</title>
     <itemizedlist>
 
@@ -8223,9 +8225,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Programming Interface (<acronym>SPI</acronym>)</title>
     <itemizedlist>
 
@@ -8266,9 +8268,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Build Options</title>
     <itemizedlist>
 
@@ -8309,9 +8311,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
     <itemizedlist>
 
@@ -8424,9 +8426,9 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Contrib</title>
     <itemizedlist>
 
@@ -8544,6 +8546,7 @@ current_date &lt; 2017-11-17
 
     </itemizedlist>
 
-   </sect3>
-  </sect2>
- </sect1>
+   </section>
+  </section>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-8.4.sgml b/doc/src/sgml/release-8.4.sgml
index 934f720387..5cb018965d 100644
--- a/doc/src/sgml/release-8.4.sgml
+++ b/doc/src/sgml/release-8.4.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-8.4.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-8-4-22">
+<section>
+ <title>Release 8.4</title>
+ <section id="release-8-4-22">
   <title>Release 8.4.22</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.22</title>
 
    <para>
@@ -39,9 +41,9 @@
     see <xref linkend="release-8-4-19"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -317,10 +319,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-21">
+ <section id="release-8-4-21">
   <title>Release 8.4.21</title>
 
   <formalpara>
@@ -340,7 +342,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.21</title>
 
    <para>
@@ -352,9 +354,9 @@
     see <xref linkend="release-8-4-19"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -436,10 +438,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-20">
+ <section id="release-8-4-20">
   <title>Release 8.4.20</title>
 
   <formalpara>
@@ -459,7 +461,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.20</title>
 
    <para>
@@ -471,9 +473,9 @@
     see <xref linkend="release-8-4-19"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -895,10 +897,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-19">
+ <section id="release-8-4-19">
   <title>Release 8.4.19</title>
 
   <formalpara>
@@ -912,7 +914,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.19</title>
 
    <para>
@@ -930,9 +932,9 @@
     see <xref linkend="release-8-4-17"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1096,10 +1098,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-18">
+ <section id="release-8-4-18">
   <title>Release 8.4.18</title>
 
   <formalpara>
@@ -1113,7 +1115,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.18</title>
 
    <para>
@@ -1125,9 +1127,9 @@
     see <xref linkend="release-8-4-17"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1296,10 +1298,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-17">
+ <section id="release-8-4-17">
   <title>Release 8.4.17</title>
 
   <formalpara>
@@ -1313,7 +1315,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.17</title>
 
    <para>
@@ -1332,9 +1334,9 @@
     see <xref linkend="release-8-4-10"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1525,10 +1527,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-16">
+ <section id="release-8-4-16">
   <title>Release 8.4.16</title>
 
   <formalpara>
@@ -1542,7 +1544,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.16</title>
 
    <para>
@@ -1554,9 +1556,9 @@
     see <xref linkend="release-8-4-10"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1735,10 +1737,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-15">
+ <section id="release-8-4-15">
   <title>Release 8.4.15</title>
 
   <formalpara>
@@ -1752,7 +1754,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.15</title>
 
    <para>
@@ -1764,9 +1766,9 @@
     see <xref linkend="release-8-4-10"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2037,10 +2039,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-14">
+ <section id="release-8-4-14">
   <title>Release 8.4.14</title>
 
   <formalpara>
@@ -2054,7 +2056,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.14</title>
 
    <para>
@@ -2066,9 +2068,9 @@
     see <xref linkend="release-8-4-10"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2153,10 +2155,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-13">
+ <section id="release-8-4-13">
   <title>Release 8.4.13</title>
 
   <formalpara>
@@ -2170,7 +2172,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.13</title>
 
    <para>
@@ -2182,9 +2184,9 @@
     see <xref linkend="release-8-4-10"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2387,10 +2389,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-12">
+ <section id="release-8-4-12">
   <title>Release 8.4.12</title>
 
   <formalpara>
@@ -2404,7 +2406,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.12</title>
 
    <para>
@@ -2416,9 +2418,9 @@
     see <xref linkend="release-8-4-10"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2672,10 +2674,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-11">
+ <section id="release-8-4-11">
   <title>Release 8.4.11</title>
 
   <formalpara>
@@ -2689,7 +2691,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.11</title>
 
    <para>
@@ -2701,9 +2703,9 @@
     see <xref linkend="release-8-4-10"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3034,10 +3036,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-10">
+ <section id="release-8-4-10">
   <title>Release 8.4.10</title>
 
   <formalpara>
@@ -3051,7 +3053,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.10</title>
 
    <para>
@@ -3070,9 +3072,9 @@
     see <xref linkend="release-8-4-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3349,10 +3351,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-9">
+ <section id="release-8-4-9">
   <title>Release 8.4.9</title>
 
   <formalpara>
@@ -3366,7 +3368,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.9</title>
 
    <para>
@@ -3378,9 +3380,9 @@
     see <xref linkend="release-8-4-8"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3874,10 +3876,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-8">
+ <section id="release-8-4-8">
   <title>Release 8.4.8</title>
 
   <formalpara>
@@ -3891,7 +3893,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.8</title>
 
    <para>
@@ -3914,9 +3916,9 @@
     see <xref linkend="release-8-4-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4119,10 +4121,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-7">
+ <section id="release-8-4-7">
   <title>Release 8.4.7</title>
 
   <formalpara>
@@ -4136,7 +4138,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.7</title>
 
    <para>
@@ -4145,9 +4147,9 @@
     see <xref linkend="release-8-4-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4251,10 +4253,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-6">
+ <section id="release-8-4-6">
   <title>Release 8.4.6</title>
 
   <formalpara>
@@ -4268,7 +4270,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.6</title>
 
    <para>
@@ -4277,9 +4279,9 @@
     see <xref linkend="release-8-4-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4562,10 +4564,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-5">
+ <section id="release-8-4-5">
   <title>Release 8.4.5</title>
 
   <formalpara>
@@ -4579,7 +4581,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.5</title>
 
    <para>
@@ -4588,9 +4590,9 @@
     see <xref linkend="release-8-4-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5084,10 +5086,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-4">
+ <section id="release-8-4-4">
   <title>Release 8.4.4</title>
 
   <formalpara>
@@ -5101,7 +5103,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.4</title>
 
    <para>
@@ -5110,9 +5112,9 @@
     see <xref linkend="release-8-4-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5375,10 +5377,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-3">
+ <section id="release-8-4-3">
   <title>Release 8.4.3</title>
 
   <formalpara>
@@ -5392,7 +5394,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.3</title>
 
    <para>
@@ -5401,9 +5403,9 @@
     see <xref linkend="release-8-4-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5842,10 +5844,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-2">
+ <section id="release-8-4-2">
   <title>Release 8.4.2</title>
 
   <formalpara>
@@ -5859,7 +5861,7 @@
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.2</title>
 
    <para>
@@ -5869,9 +5871,9 @@
     to repair possible damage.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6373,10 +6375,10 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4-1">
+ <section id="release-8-4-1">
   <title>Release 8.4.1</title>
 
   <formalpara>
@@ -6390,16 +6392,16 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
    <xref linkend="release-8-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4.1</title>
 
    <para>
     A dump/restore is not required for those running 8.4.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6672,10 +6674,10 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-8-4">
+ <section id="release-8-4">
   <title>Release 8.4</title>
 
   <formalpara>
@@ -6683,7 +6685,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
    <para>2009-07-01</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -6800,9 +6802,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Migration to Version 8.4</title>
 
    <para>
@@ -6815,7 +6817,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
     Observe the following incompatibilities:
    </para>
 
-   <sect3>
+   <section>
     <title>General</title>
     <itemizedlist>
 
@@ -6844,9 +6846,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Settings</title>
     <itemizedlist>
 
@@ -6929,9 +6931,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
 
     <itemizedlist>
@@ -7015,10 +7017,10 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Functions and Operators</title>
 
     <itemizedlist>
@@ -7122,7 +7124,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Temporal Functions and Operators</title>
 
      <itemizedlist>
@@ -7185,13 +7187,13 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -7200,7 +7202,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
     release.
    </para>
 
-   <sect3>
+   <section>
     <title>Performance</title>
     <itemizedlist>
 
@@ -7356,12 +7358,12 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server</title>
 
-    <sect4>
+    <section>
      <title>Settings</title>
 
      <itemizedlist>
@@ -7391,9 +7393,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Authentication and security</title>
      <itemizedlist>
 
@@ -7446,9 +7448,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
       </listitem>
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4 id="release-8-4-pg-hba-conf">
+    <section id="release-8-4-pg-hba-conf">
      <title><filename>pg_hba.conf</filename></title>
      <itemizedlist>
 
@@ -7566,9 +7568,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Continuous Archiving</title>
      <itemizedlist>
 
@@ -7629,9 +7631,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Monitoring</title>
      <itemizedlist>
 
@@ -7722,11 +7724,11 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
     <itemizedlist>
 
@@ -7865,7 +7867,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><command>TRUNCATE</command></title>
      <itemizedlist>
 
@@ -7902,9 +7904,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><command>EXPLAIN</command></title>
      <itemizedlist>
 
@@ -7942,9 +7944,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><literal>LIMIT</literal>/<literal>OFFSET</literal></title>
      <itemizedlist>
 
@@ -7969,11 +7971,11 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Manipulation</title>
     <itemizedlist>
 
@@ -8064,7 +8066,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><command>ALTER</command></title>
      <itemizedlist>
 
@@ -8145,9 +8147,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Database Manipulation</title>
      <itemizedlist>
 
@@ -8195,11 +8197,11 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Operations</title>
 
     <itemizedlist>
@@ -8220,7 +8222,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Indexes</title>
      <itemizedlist>
 
@@ -8268,9 +8270,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Full Text Indexes</title>
      <itemizedlist>
 
@@ -8314,9 +8316,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><command>VACUUM</command></title>
      <itemizedlist>
 
@@ -8387,11 +8389,11 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
     <itemizedlist>
 
@@ -8442,7 +8444,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Temporal Data Types</title>
      <itemizedlist>
 
@@ -8535,9 +8537,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Arrays</title>
      <itemizedlist>
 
@@ -8615,9 +8617,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Wide-Value Storage (<acronym>TOAST</acronym>)</title>
      <itemizedlist>
 
@@ -8646,11 +8648,11 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
     <itemizedlist>
 
@@ -8707,7 +8709,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Object Information Functions</title>
      <itemizedlist>
 
@@ -8857,9 +8859,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Function Creation</title>
      <itemizedlist>
 
@@ -8898,9 +8900,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>PL/pgSQL Server-Side Language</title>
      <itemizedlist>
 
@@ -9026,11 +9028,11 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Applications</title>
 
     <itemizedlist>
@@ -9065,7 +9067,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><application>psql</application></title>
      <itemizedlist>
 
@@ -9164,9 +9166,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><application>psql</application> \d* commands</title>
 
      <itemizedlist>
@@ -9260,9 +9262,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><application>pg_dump</application></title>
      <itemizedlist>
 
@@ -9358,14 +9360,14 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Programming Tools</title>
 
-    <sect4>
+    <section>
      <title><application>libpq</application></title>
      <itemizedlist>
 
@@ -9431,9 +9433,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
       </listitem>
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><application>libpq</application> <acronym>SSL</acronym> (Secure Sockets Layer)
       support</title>
      <itemizedlist>
@@ -9498,9 +9500,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><application>ecpg</application></title>
      <itemizedlist>
 
@@ -9524,9 +9526,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Server Programming Interface (<acronym>SPI</acronym>)</title>
      <itemizedlist>
 
@@ -9563,11 +9565,11 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Build Options</title>
     <itemizedlist>
 
@@ -9698,9 +9700,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
     <itemizedlist>
 
@@ -9903,9 +9905,9 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Contrib</title>
 
     <itemizedlist>
@@ -10075,6 +10077,7 @@ WITH w AS (SELECT * FROM foo) SELECT * FROM w, bar ... FOR UPDATE
 
     </itemizedlist>
 
-   </sect3>
-  </sect2>
- </sect1>
+   </section>
+  </section>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-9.0.sgml b/doc/src/sgml/release-9.0.sgml
index 9e90f5a7f3..8cb56e8c73 100644
--- a/doc/src/sgml/release-9.0.sgml
+++ b/doc/src/sgml/release-9.0.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-9.0.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-9-0-23">
+<section>
+ <title>Release 9.0</title>
+ <section id="release-9-0-23">
   <title>Release 9.0.23</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.23</title>
 
    <para>
@@ -33,9 +35,9 @@
     see <xref linkend="release-9-0-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -495,10 +497,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-22">
+ <section id="release-9-0-22">
   <title>Release 9.0.22</title>
 
   <formalpara>
@@ -518,7 +520,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.22</title>
 
    <para>
@@ -530,9 +532,9 @@
     see <xref linkend="release-9-0-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -569,10 +571,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-21">
+ <section id="release-9-0-21">
   <title>Release 9.0.21</title>
 
   <formalpara>
@@ -592,7 +594,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.21</title>
 
    <para>
@@ -604,9 +606,9 @@
     see <xref linkend="release-9-0-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -663,10 +665,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-20">
+ <section id="release-9-0-20">
   <title>Release 9.0.20</title>
 
   <formalpara>
@@ -686,7 +688,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.20</title>
 
    <para>
@@ -698,9 +700,9 @@
     see <xref linkend="release-9-0-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1107,10 +1109,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-19">
+ <section id="release-9-0-19">
   <title>Release 9.0.19</title>
 
   <formalpara>
@@ -1124,7 +1126,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.19</title>
 
    <para>
@@ -1136,9 +1138,9 @@
     see <xref linkend="release-9-0-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1833,10 +1835,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-18">
+ <section id="release-9-0-18">
   <title>Release 9.0.18</title>
 
   <formalpara>
@@ -1850,7 +1852,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.18</title>
 
    <para>
@@ -1868,9 +1870,9 @@
     see <xref linkend="release-9-0-15"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2179,10 +2181,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-17">
+ <section id="release-9-0-17">
   <title>Release 9.0.17</title>
 
   <formalpara>
@@ -2196,7 +2198,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.17</title>
 
    <para>
@@ -2208,9 +2210,9 @@
     see <xref linkend="release-9-0-15"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2332,10 +2334,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-16">
+ <section id="release-9-0-16">
   <title>Release 9.0.16</title>
 
   <formalpara>
@@ -2349,7 +2351,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.16</title>
 
    <para>
@@ -2361,9 +2363,9 @@
     see <xref linkend="release-9-0-15"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2833,10 +2835,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-15">
+ <section id="release-9-0-15">
   <title>Release 9.0.15</title>
 
   <formalpara>
@@ -2850,7 +2852,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.15</title>
 
    <para>
@@ -2868,9 +2870,9 @@
     see <xref linkend="release-9-0-13"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3071,10 +3073,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-14">
+ <section id="release-9-0-14">
   <title>Release 9.0.14</title>
 
   <formalpara>
@@ -3088,7 +3090,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.14</title>
 
    <para>
@@ -3100,9 +3102,9 @@
     see <xref linkend="release-9-0-13"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3337,10 +3339,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-13">
+ <section id="release-9-0-13">
   <title>Release 9.0.13</title>
 
   <formalpara>
@@ -3354,7 +3356,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.13</title>
 
    <para>
@@ -3373,9 +3375,9 @@
     see <xref linkend="release-9-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3634,10 +3636,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-12">
+ <section id="release-9-0-12">
   <title>Release 9.0.12</title>
 
   <formalpara>
@@ -3651,7 +3653,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.12</title>
 
    <para>
@@ -3663,9 +3665,9 @@
     see <xref linkend="release-9-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3896,10 +3898,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-11">
+ <section id="release-9-0-11">
   <title>Release 9.0.11</title>
 
   <formalpara>
@@ -3913,7 +3915,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.11</title>
 
    <para>
@@ -3925,9 +3927,9 @@
     see <xref linkend="release-9-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4274,10 +4276,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-10">
+ <section id="release-9-0-10">
   <title>Release 9.0.10</title>
 
   <formalpara>
@@ -4291,7 +4293,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.10</title>
 
    <para>
@@ -4303,9 +4305,9 @@
     see <xref linkend="release-9-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4416,10 +4418,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-9">
+ <section id="release-9-0-9">
   <title>Release 9.0.9</title>
 
   <formalpara>
@@ -4433,7 +4435,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.9</title>
 
    <para>
@@ -4445,9 +4447,9 @@
     see <xref linkend="release-9-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4722,10 +4724,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-8">
+ <section id="release-9-0-8">
   <title>Release 9.0.8</title>
 
   <formalpara>
@@ -4739,7 +4741,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.8</title>
 
    <para>
@@ -4751,9 +4753,9 @@
     see <xref linkend="release-9-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5042,10 +5044,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-7">
+ <section id="release-9-0-7">
   <title>Release 9.0.7</title>
 
   <formalpara>
@@ -5059,7 +5061,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.7</title>
 
    <para>
@@ -5071,9 +5073,9 @@
     see <xref linkend="release-9-0-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5558,10 +5560,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-6">
+ <section id="release-9-0-6">
   <title>Release 9.0.6</title>
 
   <formalpara>
@@ -5575,7 +5577,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.6</title>
 
    <para>
@@ -5594,9 +5596,9 @@
     see <xref linkend="release-9-0-4"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5942,10 +5944,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-5">
+ <section id="release-9-0-5">
   <title>Release 9.0.5</title>
 
   <formalpara>
@@ -5959,7 +5961,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.5</title>
 
    <para>
@@ -5971,9 +5973,9 @@
     see <xref linkend="release-9-0-4"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6592,10 +6594,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-4">
+ <section id="release-9-0-4">
   <title>Release 9.0.4</title>
 
   <formalpara>
@@ -6609,7 +6611,7 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.4</title>
 
    <para>
@@ -6627,9 +6629,9 @@
     http://wiki.postgresql.org/wiki/20110408pg_upgrade_fix</ulink>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6933,10 +6935,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-3">
+ <section id="release-9-0-3">
   <title>Release 9.0.3</title>
 
   <formalpara>
@@ -6950,16 +6952,16 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.3</title>
 
    <para>
     A dump/restore is not required for those running 9.0.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7109,10 +7111,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-2">
+ <section id="release-9-0-2">
   <title>Release 9.0.2</title>
 
   <formalpara>
@@ -7126,16 +7128,16 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.2</title>
 
    <para>
     A dump/restore is not required for those running 9.0.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7556,10 +7558,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0-1">
+ <section id="release-9-0-1">
   <title>Release 9.0.1</title>
 
   <formalpara>
@@ -7573,16 +7575,16 @@
    <xref linkend="release-9-0"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.0.1</title>
 
    <para>
     A dump/restore is not required for those running 9.0.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7698,10 +7700,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-0">
+ <section id="release-9-0">
   <title>Release 9.0</title>
 
   <formalpara>
@@ -7709,7 +7711,7 @@
    <para>2010-09-20</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -7872,9 +7874,9 @@
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
 
   <title>Migration to Version 9.0</title>
 
@@ -7894,7 +7896,7 @@
    Observe the following incompatibilities:
   </para>
 
-  <sect3>
+  <section>
    <title>Server Settings</title>
 
    <itemizedlist>
@@ -7935,9 +7937,9 @@
 
    </itemizedlist>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Queries</title>
 
    <itemizedlist>
@@ -7958,9 +7960,9 @@
 
    </itemizedlist>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Data Types</title>
 
    <itemizedlist>
@@ -8035,9 +8037,9 @@
 
   </itemizedlist>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Object Renaming</title>
 
    <itemizedlist>
@@ -8080,9 +8082,9 @@
 
    </itemizedlist>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>PL/pgSQL</title>
 
    <itemizedlist>
@@ -8172,9 +8174,9 @@
     </listitem>
    </itemizedlist>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Other Incompatibilities</title>
 
    <itemizedlist>
@@ -8206,10 +8208,10 @@
     </listitem>
 
    </itemizedlist>
-  </sect3>
- </sect2>
+  </section>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
    <para>
     Version 9.0 has an unprecedented number of new major features,
@@ -8217,10 +8219,10 @@
     new functions, and other changes.
    </para>
 
-  <sect3>
+  <section>
    <title>Server</title>
 
-   <sect4>
+   <section>
     <title>Continuous Archiving and Streaming Replication</title>
 
     <para>
@@ -8276,9 +8278,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Performance</title>
 
     <itemizedlist>
@@ -8322,9 +8324,9 @@
 
      </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Optimizer</title>
 
     <itemizedlist>
@@ -8370,9 +8372,9 @@
       </para>
      </listitem>
     </itemizedlist>
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title><link linkend="geqo">GEQO</link></title>
 
     <itemizedlist>
@@ -8405,9 +8407,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Optimizer Statistics</title>
 
     <itemizedlist>
@@ -8465,9 +8467,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Authentication</title>
 
     <itemizedlist>
@@ -8518,9 +8520,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Monitoring</title>
 
     <itemizedlist>
@@ -8567,9 +8569,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Statistics Counters</title>
 
     <itemizedlist>
@@ -8595,9 +8597,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Server Settings</title>
 
     <itemizedlist>
@@ -8696,11 +8698,11 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Queries</title>
 
    <itemizedlist>
@@ -8760,7 +8762,7 @@
 
    </itemizedlist>
 
-   <sect4>
+   <section>
     <title>Unicode Strings</title>
 
     <itemizedlist>
@@ -8784,11 +8786,11 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Object Manipulation</title>
 
    <itemizedlist>
@@ -8831,7 +8833,7 @@
 
    </itemizedlist>
 
-   <sect4>
+   <section>
     <title><command>ALTER TABLE</command></title>
 
     <itemizedlist>
@@ -8867,9 +8869,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title><link linkend="sql-createtable"><command>CREATE TABLE</command></link></title>
 
     <itemizedlist>
@@ -8905,9 +8907,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Constraints</title>
 
     <itemizedlist>
@@ -8965,9 +8967,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Object Permissions</title>
 
     <itemizedlist>
@@ -9017,11 +9019,11 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Utility Operations</title>
 
    <itemizedlist>
@@ -9067,7 +9069,7 @@
 
    </itemizedlist>
 
-   <sect4>
+   <section>
     <title><link linkend="sql-copy"><command>COPY</command></link></title>
 
     <itemizedlist>
@@ -9098,9 +9100,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title><link linkend="sql-explain"><command>EXPLAIN</command></link></title>
 
     <itemizedlist>
@@ -9153,9 +9155,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title><link linkend="sql-vacuum"><command>VACUUM</command></link></title>
 
     <itemizedlist>
@@ -9190,9 +9192,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Indexes</title>
 
     <itemizedlist>
@@ -9256,11 +9258,11 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Data Types</title>
 
    <itemizedlist>
@@ -9313,7 +9315,7 @@
 
    </itemizedlist>
 
-   <sect4>
+   <section>
     <title><link linkend="textsearch">Full Text Search</link></title>
 
     <itemizedlist>
@@ -9351,11 +9353,11 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Functions</title>
 
    <itemizedlist>
@@ -9442,7 +9444,7 @@
 
    </itemizedlist>
 
-   <sect4>
+   <section>
     <title>Aggregates</title>
 
     <itemizedlist>
@@ -9493,9 +9495,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Bit Strings</title>
 
     <itemizedlist>
@@ -9521,9 +9523,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Object Information Functions</title>
 
     <itemizedlist>
@@ -9571,9 +9573,9 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Function and Trigger Creation</title>
 
     <itemizedlist>
@@ -9623,11 +9625,11 @@
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Server-Side Languages</title>
 
    <itemizedlist>
@@ -9648,7 +9650,7 @@
 
     </itemizedlist>
 
-    <sect4>
+    <section>
     <title><link linkend="plpgsql">PL/pgSQL</link> Server-Side
     Language</title>
 
@@ -9772,9 +9774,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title><link linkend="plperl">PL/Perl</link> Server-Side Language</title>
 
     <itemizedlist>
@@ -9859,9 +9861,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title><link linkend="plpython">PL/Python</link> Server-Side Language</title>
 
     <itemizedlist>
@@ -9925,11 +9927,11 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Client Applications</title>
 
    <itemizedlist>
@@ -9944,7 +9946,7 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
    </itemizedlist>
 
-   <sect4>
+   <section>
     <title><link linkend="app-psql"><application>psql</application></link></title>
 
     <itemizedlist>
@@ -10008,7 +10010,7 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-    <sect5>
+    <section>
     <title><application>psql</application> Display</title>
 
      <itemizedlist>
@@ -10035,9 +10037,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
      </itemizedlist>
 
-    </sect5>
+    </section>
 
-    <sect5>
+    <section>
      <title><application>psql</application> <link
      linkend="app-psql-meta-commands"><command>\d</command></link>
      Commands</title>
@@ -10080,10 +10082,10 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
      </itemizedlist>
 
-    </sect5>
-   </sect4>
+    </section>
+   </section>
 
-   <sect4>
+   <section>
     <title><link linkend="app-pgdump"><application>pg_dump</application></link></title>
 
     <itemizedlist>
@@ -10154,9 +10156,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title><link
     linkend="app-pg-ctl"><application>pg_ctl</application></link></title>
 
@@ -10185,14 +10187,14 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title><application>Development Tools</application></title>
 
-   <sect4>
+   <section>
     <title><link linkend="libpq"><application>libpq</application></link></title>
 
     <itemizedlist>
@@ -10285,9 +10287,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title><link linkend="ecpg"><application>ecpg</application></link></title>
 
     <itemizedlist>
@@ -10357,7 +10359,7 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
      </itemizedlist>
 
-     <sect5>
+     <section>
       <title><application>ecpg</application> Cursors</title>
 
       <itemizedlist>
@@ -10391,13 +10393,13 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
      </itemizedlist>
 
-    </sect5>
+    </section>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Build Options</title>
 
    <itemizedlist>
@@ -10433,7 +10435,7 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
    </itemizedlist>
 
-   <sect4>
+   <section>
     <title>Makefiles</title>
 
     <itemizedlist>
@@ -10471,9 +10473,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Windows</title>
 
     <itemizedlist>
@@ -10501,11 +10503,11 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Source Code</title>
 
    <itemizedlist>
@@ -10699,7 +10701,7 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
    </itemizedlist>
 
-   <sect4>
+   <section>
     <title>New Build Requirements</title>
 
      <para>
@@ -10732,9 +10734,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Portability</title>
 
     <itemizedlist>
@@ -10786,9 +10788,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Server Programming</title>
 
     <itemizedlist>
@@ -10856,9 +10858,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Server Hooks</title>
 
     <itemizedlist>
@@ -10879,9 +10881,9 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   <sect4>
+   <section>
     <title>Binary Upgrade Support</title>
 
     <itemizedlist>
@@ -10930,11 +10932,11 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Contrib</title>
 
    <itemizedlist>
@@ -11086,6 +11088,7 @@ if TG_OP = 'INSERT' and NEW.col1 = ... then
 
    </itemizedlist>
 
-  </sect3>
- </sect2>
-</sect1>
+  </section>
+ </section>
+</section>
+</section>
diff --git a/doc/src/sgml/release-9.1.sgml b/doc/src/sgml/release-9.1.sgml
index e928bf3cb7..1556107a88 100644
--- a/doc/src/sgml/release-9.1.sgml
+++ b/doc/src/sgml/release-9.1.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-9.1.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-9-1-24">
+<section>
+ <title>Release 9.1</title>
+ <section id="release-9-1-24">
   <title>Release 9.1.24</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.24</title>
 
    <para>
@@ -33,9 +35,9 @@
     see <xref linkend="release-9-1-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -208,10 +210,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-23">
+ <section id="release-9-1-23">
   <title>Release 9.1.23</title>
 
   <formalpara>
@@ -231,7 +233,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.23</title>
 
    <para>
@@ -243,9 +245,9 @@
     see <xref linkend="release-9-1-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -550,10 +552,10 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-22">
+ <section id="release-9-1-22">
   <title>Release 9.1.22</title>
 
   <formalpara>
@@ -573,7 +575,7 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.22</title>
 
    <para>
@@ -585,9 +587,9 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
     see <xref linkend="release-9-1-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -715,10 +717,10 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-21">
+ <section id="release-9-1-21">
   <title>Release 9.1.21</title>
 
   <formalpara>
@@ -732,7 +734,7 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.21</title>
 
    <para>
@@ -744,9 +746,9 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
     see <xref linkend="release-9-1-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -921,10 +923,10 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-20">
+ <section id="release-9-1-20">
   <title>Release 9.1.20</title>
 
   <formalpara>
@@ -938,7 +940,7 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.20</title>
 
    <para>
@@ -950,9 +952,9 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
     see <xref linkend="release-9-1-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1434,10 +1436,10 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-19">
+ <section id="release-9-1-19">
   <title>Release 9.1.19</title>
 
   <formalpara>
@@ -1451,7 +1453,7 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.19</title>
 
    <para>
@@ -1463,9 +1465,9 @@ Branch: REL9_1_STABLE [354b3a3ac] 2016-06-19 14:01:17 -0400
     see <xref linkend="release-9-1-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1995,10 +1997,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-18">
+ <section id="release-9-1-18">
   <title>Release 9.1.18</title>
 
   <formalpara>
@@ -2012,7 +2014,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.18</title>
 
    <para>
@@ -2024,9 +2026,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2063,10 +2065,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-17">
+ <section id="release-9-1-17">
   <title>Release 9.1.17</title>
 
   <formalpara>
@@ -2080,7 +2082,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.17</title>
 
    <para>
@@ -2092,9 +2094,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2151,10 +2153,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-16">
+ <section id="release-9-1-16">
   <title>Release 9.1.16</title>
 
   <formalpara>
@@ -2168,7 +2170,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.16</title>
 
    <para>
@@ -2186,9 +2188,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2677,10 +2679,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-15">
+ <section id="release-9-1-15">
   <title>Release 9.1.15</title>
 
   <formalpara>
@@ -2694,7 +2696,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.15</title>
 
    <para>
@@ -2706,9 +2708,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-14"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3487,10 +3489,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-14">
+ <section id="release-9-1-14">
   <title>Release 9.1.14</title>
 
   <formalpara>
@@ -3504,7 +3506,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.14</title>
 
    <para>
@@ -3522,9 +3524,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3870,10 +3872,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-13">
+ <section id="release-9-1-13">
   <title>Release 9.1.13</title>
 
   <formalpara>
@@ -3887,7 +3889,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.13</title>
 
    <para>
@@ -3899,9 +3901,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4037,10 +4039,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-12">
+ <section id="release-9-1-12">
   <title>Release 9.1.12</title>
 
   <formalpara>
@@ -4054,7 +4056,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.12</title>
 
    <para>
@@ -4066,9 +4068,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4587,10 +4589,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-11">
+ <section id="release-9-1-11">
   <title>Release 9.1.11</title>
 
   <formalpara>
@@ -4604,7 +4606,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.11</title>
 
    <para>
@@ -4622,9 +4624,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-9"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4844,10 +4846,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-10">
+ <section id="release-9-1-10">
   <title>Release 9.1.10</title>
 
   <formalpara>
@@ -4861,7 +4863,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.10</title>
 
    <para>
@@ -4873,9 +4875,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-9"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5179,10 +5181,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-9">
+ <section id="release-9-1-9">
   <title>Release 9.1.9</title>
 
   <formalpara>
@@ -5196,7 +5198,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.9</title>
 
    <para>
@@ -5215,9 +5217,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5513,10 +5515,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-8">
+ <section id="release-9-1-8">
   <title>Release 9.1.8</title>
 
   <formalpara>
@@ -5530,7 +5532,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.8</title>
 
    <para>
@@ -5542,9 +5544,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5835,10 +5837,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-7">
+ <section id="release-9-1-7">
   <title>Release 9.1.7</title>
 
   <formalpara>
@@ -5852,7 +5854,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.7</title>
 
    <para>
@@ -5864,9 +5866,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6298,10 +6300,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-6">
+ <section id="release-9-1-6">
   <title>Release 9.1.6</title>
 
   <formalpara>
@@ -6315,7 +6317,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.6</title>
 
    <para>
@@ -6333,9 +6335,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-4"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6550,10 +6552,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-5">
+ <section id="release-9-1-5">
   <title>Release 9.1.5</title>
 
   <formalpara>
@@ -6567,7 +6569,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.5</title>
 
    <para>
@@ -6579,9 +6581,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-4"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6937,10 +6939,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-4">
+ <section id="release-9-1-4">
   <title>Release 9.1.4</title>
 
   <formalpara>
@@ -6954,7 +6956,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.4</title>
 
    <para>
@@ -6978,9 +6980,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7427,10 +7429,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-3">
+ <section id="release-9-1-3">
   <title>Release 9.1.3</title>
 
   <formalpara>
@@ -7444,7 +7446,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.3</title>
 
    <para>
@@ -7456,9 +7458,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     see <xref linkend="release-9-1-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -8064,10 +8066,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-2">
+ <section id="release-9-1-2">
   <title>Release 9.1.2</title>
 
   <formalpara>
@@ -8081,7 +8083,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.2</title>
 
    <para>
@@ -8107,9 +8109,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     as explained in the second changelog item.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -8711,10 +8713,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1-1">
+ <section id="release-9-1-1">
   <title>Release 9.1.1</title>
 
   <formalpara>
@@ -8728,16 +8730,16 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <xref linkend="release-9-1"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.1.1</title>
 
    <para>
     A dump/restore is not required for those running 9.1.X.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -8779,10 +8781,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-1">
+ <section id="release-9-1">
   <title>Release 9.1</title>
 
   <formalpara>
@@ -8790,7 +8792,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
    <para>2011-09-12</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -8886,9 +8888,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
 
   <title>Migration to Version 9.1</title>
 
@@ -8904,7 +8906,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     with previous releases.  Observe the following incompatibilities:
    </para>
 
-   <sect3>
+   <section>
     <title>Strings</title>
 
     <itemizedlist>
@@ -8940,9 +8942,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Casting</title>
 
     <itemizedlist>
@@ -8983,9 +8985,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Arrays</title>
 
     <itemizedlist>
@@ -9018,9 +9020,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Modification</title>
 
     <itemizedlist>
@@ -9047,9 +9049,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Settings</title>
 
     <itemizedlist>
@@ -9081,9 +9083,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="plpgsql">PL/pgSQL</link> Server-Side Language</title>
 
     <itemizedlist>
@@ -9144,9 +9146,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Contrib</title>
 
     <itemizedlist>
@@ -9170,9 +9172,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Other Incompatibilities</title>
 
     <itemizedlist>
@@ -9206,10 +9208,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-   </sect3>
-  </sect2>
+   </section>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -9218,10 +9220,10 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
     release.
    </para>
 
-   <sect3>
+   <section>
     <title>Server</title>
 
-    <sect4>
+    <section>
      <title>Performance</title>
 
      <itemizedlist>
@@ -9302,9 +9304,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Optimizer</title>
 
      <itemizedlist>
@@ -9336,9 +9338,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Authentication</title>
 
      <itemizedlist>
@@ -9429,9 +9431,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Monitoring</title>
 
      <itemizedlist>
@@ -9472,9 +9474,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Statistical Views</title>
 
      <itemizedlist>
@@ -9535,9 +9537,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Server Settings</title>
 
      <itemizedlist>
@@ -9572,14 +9574,14 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
       </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Replication and Recovery</title>
 
-   <sect4>
+   <section>
     <title>Streaming Replication and Continuous Archiving</title>
 
     <itemizedlist>
@@ -9657,9 +9659,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Replication Monitoring</title>
 
      <itemizedlist>
@@ -9692,9 +9694,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Hot Standby</title>
 
      <itemizedlist>
@@ -9766,9 +9768,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Recovery Control</title>
 
      <itemizedlist>
@@ -9855,11 +9857,11 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
 
      <itemizedlist>
@@ -9945,7 +9947,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Strings</title>
 
      <itemizedlist>
@@ -9967,11 +9969,11 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Manipulation</title>
 
      <itemizedlist>
@@ -10028,7 +10030,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title><command>ALTER</command> Object</title>
 
      <itemizedlist>
@@ -10075,9 +10077,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="sql-createtable"><command>CREATE/ALTER TABLE</command></link></title>
 
      <itemizedlist>
@@ -10152,9 +10154,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Object Permissions</title>
 
      <itemizedlist>
@@ -10172,11 +10174,11 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Operations</title>
 
     <itemizedlist>
@@ -10209,7 +10211,7 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="sql-copy"><command>COPY</command></link></title>
 
      <itemizedlist>
@@ -10240,9 +10242,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="sql-explain"><command>EXPLAIN</command></link></title>
 
       <itemizedlist>
@@ -10256,9 +10258,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="sql-vacuum"><command>VACUUM</command></link></title>
 
      <itemizedlist>
@@ -10290,9 +10292,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="sql-cluster"><command>CLUSTER</command></link></title>
 
      <itemizedlist>
@@ -10306,9 +10308,9 @@ Branch: REL9_0_STABLE [9d6af7367] 2015-08-15 11:02:34 -0400
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Indexes</title>
 
      <itemizedlist>
@@ -10369,11 +10371,11 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
 
     <itemizedlist>
@@ -10439,7 +10441,7 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Casting</title>
 
      <itemizedlist>
@@ -10472,9 +10474,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="functions-xml"><acronym>XML</acronym></link></title>
 
      <itemizedlist>
@@ -10512,11 +10514,11 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
 
      <itemizedlist>
@@ -10581,7 +10583,7 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Object Information Functions</title>
 
      <itemizedlist>
@@ -10658,9 +10660,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Function and Trigger Creation</title>
 
      <itemizedlist>
@@ -10678,14 +10680,14 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server-Side Languages</title>
 
-    <sect4>
+    <section>
      <title><link linkend="plpgsql">PL/pgSQL</link> Server-Side Language</title>
 
      <itemizedlist>
@@ -10719,9 +10721,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="plperl">PL/Perl</link> Server-Side Language</title>
 
      <itemizedlist>
@@ -10762,9 +10764,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="plpython">PL/Python</link> Server-Side Language</title>
 
      <itemizedlist>
@@ -10848,11 +10850,11 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Applications</title>
 
     <itemizedlist>
@@ -10867,7 +10869,7 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="app-psql"><application>psql</application></link></title>
 
      <itemizedlist>
@@ -10959,9 +10961,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="app-pgdump"><application>pg_dump</application></link></title>
 
      <itemizedlist>
@@ -10990,9 +10992,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="app-pg-ctl"><application>pg_ctl</application></link></title>
 
      <itemizedlist>
@@ -11033,14 +11035,14 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><application>Development Tools</application></title>
 
-    <sect4>
+    <section>
      <title><link linkend="libpq"><application>libpq</application></link></title>
 
      <itemizedlist>
@@ -11105,9 +11107,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="ecpg"><application>ECPG</application></link></title>
 
      <itemizedlist>
@@ -11128,11 +11130,11 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
       </listitem>
 
      </itemizedlist>
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Build Options</title>
 
      <itemizedlist>
@@ -11151,7 +11153,7 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Makefiles</title>
 
      <itemizedlist>
@@ -11208,9 +11210,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Windows</title>
 
      <itemizedlist>
@@ -11248,11 +11250,11 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
 
      <itemizedlist>
@@ -11352,7 +11354,7 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Server Hooks</title>
 
      <itemizedlist>
@@ -11379,11 +11381,11 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Contrib</title>
 
     <itemizedlist>
@@ -11514,7 +11516,7 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Security</title>
 
      <itemizedlist>
@@ -11559,9 +11561,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Performance</title>
 
      <itemizedlist>
@@ -11609,9 +11611,9 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Fsync Testing</title>
 
      <itemizedlist>
@@ -11647,11 +11649,11 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Documentation</title>
 
     <itemizedlist>
@@ -11754,7 +11756,8 @@ SELECT * FROM places ORDER BY location <-> point '(101,456)' LIMIT 10;
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-9.2.sgml b/doc/src/sgml/release-9.2.sgml
index e012f7fb6c..e86b5b490e 100644
--- a/doc/src/sgml/release-9.2.sgml
+++ b/doc/src/sgml/release-9.2.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-9.2.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-9-2-24">
+<section>
+ <title>Release 9.2</title>
+ <section id="release-9-2-24">
   <title>Release 9.2.24</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.24</title>
 
    <para>
@@ -33,9 +35,9 @@
     see <xref linkend="release-9-2-22"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -199,10 +201,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-23">
+ <section id="release-9-2-23">
   <title>Release 9.2.23</title>
 
   <formalpara>
@@ -222,7 +224,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.23</title>
 
    <para>
@@ -234,9 +236,9 @@
     see <xref linkend="release-9-2-22"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -368,10 +370,10 @@ CREATE OR REPLACE VIEW table_privileges AS
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-22">
+ <section id="release-9-2-22">
   <title>Release 9.2.22</title>
 
   <formalpara>
@@ -391,7 +393,7 @@ CREATE OR REPLACE VIEW table_privileges AS
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.22</title>
 
    <para>
@@ -408,9 +410,9 @@ CREATE OR REPLACE VIEW table_privileges AS
     see <xref linkend="release-9-2-20"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -834,10 +836,10 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-21">
+ <section id="release-9-2-21">
   <title>Release 9.2.21</title>
 
   <formalpara>
@@ -857,7 +859,7 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.21</title>
 
    <para>
@@ -874,9 +876,9 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
     see <xref linkend="release-9-2-20"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1214,10 +1216,10 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-20">
+ <section id="release-9-2-20">
   <title>Release 9.2.20</title>
 
   <formalpara>
@@ -1231,7 +1233,7 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.20</title>
 
    <para>
@@ -1249,9 +1251,9 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
     see <xref linkend="release-9-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1626,10 +1628,10 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-19">
+ <section id="release-9-2-19">
   <title>Release 9.2.19</title>
 
   <formalpara>
@@ -1643,7 +1645,7 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.19</title>
 
    <para>
@@ -1655,9 +1657,9 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
     see <xref linkend="release-9-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1892,10 +1894,10 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-18">
+ <section id="release-9-2-18">
   <title>Release 9.2.18</title>
 
   <formalpara>
@@ -1909,7 +1911,7 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.18</title>
 
    <para>
@@ -1921,9 +1923,9 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
     see <xref linkend="release-9-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2233,10 +2235,10 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-17">
+ <section id="release-9-2-17">
   <title>Release 9.2.17</title>
 
   <formalpara>
@@ -2250,7 +2252,7 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.17</title>
 
    <para>
@@ -2262,9 +2264,9 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
     see <xref linkend="release-9-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2429,10 +2431,10 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-16">
+ <section id="release-9-2-16">
   <title>Release 9.2.16</title>
 
   <formalpara>
@@ -2446,7 +2448,7 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.16</title>
 
    <para>
@@ -2458,9 +2460,9 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
     see <xref linkend="release-9-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2635,10 +2637,10 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-15">
+ <section id="release-9-2-15">
   <title>Release 9.2.15</title>
 
   <formalpara>
@@ -2652,7 +2654,7 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.15</title>
 
    <para>
@@ -2664,9 +2666,9 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
     see <xref linkend="release-9-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3179,10 +3181,10 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-14">
+ <section id="release-9-2-14">
   <title>Release 9.2.14</title>
 
   <formalpara>
@@ -3196,7 +3198,7 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.14</title>
 
    <para>
@@ -3208,9 +3210,9 @@ Branch: REL9_2_STABLE [38bec1805] 2017-01-25 07:02:25 +0900
     see <xref linkend="release-9-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3776,10 +3778,10 @@ Branch: REL9_2_STABLE [e90a629e1] 2015-09-22 14:58:38 -0700
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-13">
+ <section id="release-9-2-13">
   <title>Release 9.2.13</title>
 
   <formalpara>
@@ -3793,7 +3795,7 @@ Branch: REL9_2_STABLE [e90a629e1] 2015-09-22 14:58:38 -0700
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.13</title>
 
    <para>
@@ -3805,9 +3807,9 @@ Branch: REL9_2_STABLE [e90a629e1] 2015-09-22 14:58:38 -0700
     see <xref linkend="release-9-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3844,10 +3846,10 @@ Branch: REL9_2_STABLE [e90a629e1] 2015-09-22 14:58:38 -0700
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-12">
+ <section id="release-9-2-12">
   <title>Release 9.2.12</title>
 
   <formalpara>
@@ -3861,7 +3863,7 @@ Branch: REL9_2_STABLE [e90a629e1] 2015-09-22 14:58:38 -0700
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.12</title>
 
    <para>
@@ -3873,9 +3875,9 @@ Branch: REL9_2_STABLE [e90a629e1] 2015-09-22 14:58:38 -0700
     see <xref linkend="release-9-2-11"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3939,10 +3941,10 @@ Branch: REL9_2_STABLE [e90a629e1] 2015-09-22 14:58:38 -0700
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-11">
+ <section id="release-9-2-11">
   <title>Release 9.2.11</title>
 
   <formalpara>
@@ -3956,7 +3958,7 @@ Branch: REL9_2_STABLE [e90a629e1] 2015-09-22 14:58:38 -0700
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.11</title>
 
    <para>
@@ -3974,9 +3976,9 @@ Branch: REL9_2_STABLE [e90a629e1] 2015-09-22 14:58:38 -0700
     see <xref linkend="release-9-2-10"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4521,10 +4523,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-10">
+ <section id="release-9-2-10">
   <title>Release 9.2.10</title>
 
   <formalpara>
@@ -4538,7 +4540,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.10</title>
 
    <para>
@@ -4559,9 +4561,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     see <xref linkend="release-9-2-9"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5438,10 +5440,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-9">
+ <section id="release-9-2-9">
   <title>Release 9.2.9</title>
 
   <formalpara>
@@ -5455,7 +5457,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.9</title>
 
    <para>
@@ -5473,9 +5475,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     see <xref linkend="release-9-2-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5919,10 +5921,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-8">
+ <section id="release-9-2-8">
   <title>Release 9.2.8</title>
 
   <formalpara>
@@ -5936,7 +5938,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.8</title>
 
    <para>
@@ -5948,9 +5950,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     see <xref linkend="release-9-2-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6108,10 +6110,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-7">
+ <section id="release-9-2-7">
   <title>Release 9.2.7</title>
 
   <formalpara>
@@ -6125,7 +6127,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.7</title>
 
    <para>
@@ -6137,9 +6139,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     see <xref linkend="release-9-2-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6715,10 +6717,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-6">
+ <section id="release-9-2-6">
   <title>Release 9.2.6</title>
 
   <formalpara>
@@ -6732,7 +6734,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.6</title>
 
    <para>
@@ -6750,9 +6752,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     see <xref linkend="release-9-2-4"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7052,10 +7054,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-5">
+ <section id="release-9-2-5">
   <title>Release 9.2.5</title>
 
   <formalpara>
@@ -7069,7 +7071,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.5</title>
 
    <para>
@@ -7081,9 +7083,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     see <xref linkend="release-9-2-4"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7471,10 +7473,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-4">
+ <section id="release-9-2-4">
   <title>Release 9.2.4</title>
 
   <formalpara>
@@ -7488,7 +7490,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.4</title>
 
    <para>
@@ -7507,9 +7509,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     see <xref linkend="release-9-2-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7878,10 +7880,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-3">
+ <section id="release-9-2-3">
   <title>Release 9.2.3</title>
 
   <formalpara>
@@ -7895,7 +7897,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.3</title>
 
    <para>
@@ -7907,9 +7909,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     see <xref linkend="release-9-2-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -8329,10 +8331,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-2">
+ <section id="release-9-2-2">
   <title>Release 9.2.2</title>
 
   <formalpara>
@@ -8346,7 +8348,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.2</title>
 
    <para>
@@ -8364,9 +8366,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     see <xref linkend="release-9-2-1"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -9053,10 +9055,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2-1">
+ <section id="release-9-2-1">
   <title>Release 9.2.1</title>
 
   <formalpara>
@@ -9070,7 +9072,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <xref linkend="release-9-2"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.2.1</title>
 
    <para>
@@ -9083,9 +9085,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     corruption bug described in the first changelog item below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -9221,10 +9223,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-2">
+ <section id="release-9-2">
   <title>Release 9.2</title>
 
   <formalpara>
@@ -9232,7 +9234,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
    <para>2012-09-10</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -9339,9 +9341,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
 
   <title>Migration to Version 9.2</title>
 
@@ -9356,7 +9358,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     with previous releases.  Observe the following incompatibilities:
    </para>
 
-   <sect3>
+   <section>
     <title>System Catalogs</title>
 
     <itemizedlist>
@@ -9396,9 +9398,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
 
     <itemizedlist>
@@ -9492,9 +9494,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Modification</title>
 
     <itemizedlist>
@@ -9542,9 +9544,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Command-Line Tools</title>
 
     <itemizedlist>
@@ -9602,9 +9604,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Settings</title>
 
     <itemizedlist>
@@ -9657,9 +9659,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
       </listitem>
 
     </itemizedlist>
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Monitoring</title>
 
     <itemizedlist>
@@ -9720,11 +9722,11 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -9733,10 +9735,10 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
     release.
    </para>
 
-   <sect3>
+   <section>
     <title>Server</title>
 
-    <sect4>
+    <section>
      <title>Performance</title>
 
      <itemizedlist>
@@ -9897,9 +9899,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Process Management</title>
 
      <itemizedlist>
@@ -9948,9 +9950,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Optimizer</title>
 
      <itemizedlist>
@@ -10089,9 +10091,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Authentication</title>
 
      <itemizedlist>
@@ -10137,9 +10139,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Monitoring</title>
 
      <itemizedlist>
@@ -10216,9 +10218,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Statistical Views</title>
 
      <itemizedlist>
@@ -10256,9 +10258,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Server Settings</title>
 
      <itemizedlist>
@@ -10343,7 +10345,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-     <sect5>
+     <section>
       <title><filename>postgresql.conf</filename></title>
 
       <itemizedlist>
@@ -10406,13 +10408,13 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
       </itemizedlist>
 
-     </sect5>
+     </section>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Replication and Recovery</title>
 
      <itemizedlist>
@@ -10480,9 +10482,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
 
      <itemizedlist>
@@ -10562,9 +10564,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Manipulation</title>
 
      <itemizedlist>
@@ -10609,7 +10611,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Constraints</title>
 
      <itemizedlist>
@@ -10657,9 +10659,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
       </listitem>
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><command>ALTER</command></title>
 
      <itemizedlist>
@@ -10738,9 +10740,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="sql-createtable"><command>CREATE TABLE</command></link></title>
 
      <itemizedlist>
@@ -10774,9 +10776,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Object Permissions</title>
 
      <itemizedlist>
@@ -10836,11 +10838,11 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Operations</title>
 
     <itemizedlist>
@@ -10885,9 +10887,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
 
     <itemizedlist>
@@ -10996,9 +10998,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
 
      <itemizedlist>
@@ -11097,9 +11099,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="information-schema">Information Schema</link></title>
 
      <itemizedlist>
@@ -11169,12 +11171,12 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server-Side Languages</title>
 
-    <sect4>
+    <section>
      <title><link linkend="plpgsql">PL/pgSQL</link> Server-Side Language</title>
 
      <itemizedlist>
@@ -11216,9 +11218,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="plpython">PL/Python</link> Server-Side Language</title>
 
      <itemizedlist>
@@ -11254,9 +11256,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="xfunc-sql">SQL</link> Server-Side Language</title>
 
      <itemizedlist>
@@ -11273,11 +11275,11 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
       </listitem>
 
      </itemizedlist>
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Applications</title>
 
     <itemizedlist>
@@ -11323,7 +11325,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="app-psql"><application>psql</application></link></title>
 
      <itemizedlist>
@@ -11438,9 +11440,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Informational Commands</title>
 
      <itemizedlist>
@@ -11499,9 +11501,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Tab Completion</title>
 
      <itemizedlist>
@@ -11546,9 +11548,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="app-pgdump"><application>pg_dump</application></link></title>
 
      <itemizedlist>
@@ -11646,11 +11648,11 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-    <sect3>
+    <section>
      <title><link linkend="libpq"><application>libpq</application></link></title>
 
      <itemizedlist>
@@ -11725,9 +11727,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
 
      <itemizedlist>
@@ -11873,9 +11875,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Additional Modules</title>
 
     <itemizedlist>
@@ -11953,7 +11955,7 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="pgupgrade"><application>pg_upgrade</application></link></title>
 
      <itemizedlist>
@@ -12057,9 +12059,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="pgstatstatements"><application>pg_stat_statements</application></link></title>
 
      <itemizedlist>
@@ -12093,9 +12095,9 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="sepgsql">sepgsql</link></title>
 
      <itemizedlist>
@@ -12139,11 +12141,11 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
       </listitem>
 
      </itemizedlist>
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Documentation</title>
 
     <itemizedlist>
@@ -12195,7 +12197,8 @@ Branch: REL9_2_STABLE [6b700301c] 2015-02-17 16:03:00 +0100
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-9.3.sgml b/doc/src/sgml/release-9.3.sgml
index 3575cb5d76..fca9653b93 100644
--- a/doc/src/sgml/release-9.3.sgml
+++ b/doc/src/sgml/release-9.3.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-9.3.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-9-3-25">
+<section>
+ <title>Release 9.3</title>
+ <section id="release-9-3-25">
   <title>Release 9.3.25</title>
 
   <formalpara>
@@ -21,7 +23,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.25</title>
 
    <para>
@@ -32,9 +34,9 @@
     However, if you are upgrading from a version earlier than 9.3.23,
     see <xref linkend="release-9-3-23"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -464,10 +466,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-24">
+ <section id="release-9-3-24">
   <title>Release 9.3.24</title>
 
   <formalpara>
@@ -487,7 +489,7 @@
    Users are encouraged to update to a newer release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.24</title>
 
    <para>
@@ -498,9 +500,9 @@
     However, if you are upgrading from a version earlier than 9.3.23,
     see <xref linkend="release-9-3-23"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -781,10 +783,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-23">
+ <section id="release-9-3-23">
   <title>Release 9.3.23</title>
 
   <formalpara>
@@ -798,7 +800,7 @@
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.23</title>
 
    <para>
@@ -815,9 +817,9 @@
     Also, if you are upgrading from a version earlier than 9.3.22,
     see <xref linkend="release-9-3-22"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1150,10 +1152,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-22">
+ <section id="release-9-3-22">
   <title>Release 9.3.22</title>
 
   <formalpara>
@@ -1167,7 +1169,7 @@
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.22</title>
 
    <para>
@@ -1194,9 +1196,9 @@
     Also, if you are upgrading from a version earlier than 9.3.18,
     see <xref linkend="release-9-3-18"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1336,10 +1338,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-21">
+ <section id="release-9-3-21">
   <title>Release 9.3.21</title>
 
   <formalpara>
@@ -1353,7 +1355,7 @@
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.21</title>
 
    <para>
@@ -1364,9 +1366,9 @@
     However, if you are upgrading from a version earlier than 9.3.18,
     see <xref linkend="release-9-3-18"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1658,10 +1660,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-20">
+ <section id="release-9-3-20">
   <title>Release 9.3.20</title>
 
   <formalpara>
@@ -1675,7 +1677,7 @@
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.20</title>
 
    <para>
@@ -1687,9 +1689,9 @@
     see <xref linkend="release-9-3-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1892,10 +1894,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-19">
+ <section id="release-9-3-19">
   <title>Release 9.3.19</title>
 
   <formalpara>
@@ -1909,7 +1911,7 @@
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.19</title>
 
    <para>
@@ -1921,9 +1923,9 @@
     see <xref linkend="release-9-3-18"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2063,10 +2065,10 @@ CREATE OR REPLACE VIEW table_privileges AS
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-18">
+ <section id="release-9-3-18">
   <title>Release 9.3.18</title>
 
   <formalpara>
@@ -2080,7 +2082,7 @@ CREATE OR REPLACE VIEW table_privileges AS
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.18</title>
 
    <para>
@@ -2097,9 +2099,9 @@ CREATE OR REPLACE VIEW table_privileges AS
     see <xref linkend="release-9-3-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2622,10 +2624,10 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-17">
+ <section id="release-9-3-17">
   <title>Release 9.3.17</title>
 
   <formalpara>
@@ -2639,7 +2641,7 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.17</title>
 
    <para>
@@ -2656,9 +2658,9 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
     see <xref linkend="release-9-3-16"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3041,10 +3043,10 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-16">
+ <section id="release-9-3-16">
   <title>Release 9.3.16</title>
 
   <formalpara>
@@ -3058,7 +3060,7 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.16</title>
 
    <para>
@@ -3076,9 +3078,9 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
     see <xref linkend="release-9-3-15"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3489,10 +3491,10 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-15">
+ <section id="release-9-3-15">
   <title>Release 9.3.15</title>
 
   <formalpara>
@@ -3506,7 +3508,7 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.15</title>
 
    <para>
@@ -3524,9 +3526,9 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
     see <xref linkend="release-9-3-9"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3818,10 +3820,10 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-14">
+ <section id="release-9-3-14">
   <title>Release 9.3.14</title>
 
   <formalpara>
@@ -3835,7 +3837,7 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.14</title>
 
    <para>
@@ -3847,9 +3849,9 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
     see <xref linkend="release-9-3-9"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4308,10 +4310,10 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-13">
+ <section id="release-9-3-13">
   <title>Release 9.3.13</title>
 
   <formalpara>
@@ -4325,7 +4327,7 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.13</title>
 
    <para>
@@ -4337,9 +4339,9 @@ UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
     see <xref linkend="release-9-3-9"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4538,10 +4540,10 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-12">
+ <section id="release-9-3-12">
   <title>Release 9.3.12</title>
 
   <formalpara>
@@ -4555,7 +4557,7 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.12</title>
 
    <para>
@@ -4567,9 +4569,9 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
     see <xref linkend="release-9-3-9"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4757,10 +4759,10 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-11">
+ <section id="release-9-3-11">
   <title>Release 9.3.11</title>
 
   <formalpara>
@@ -4774,7 +4776,7 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.11</title>
 
    <para>
@@ -4786,9 +4788,9 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
     see <xref linkend="release-9-3-9"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5380,10 +5382,10 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-10">
+ <section id="release-9-3-10">
   <title>Release 9.3.10</title>
 
   <formalpara>
@@ -5397,7 +5399,7 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.10</title>
 
    <para>
@@ -5409,9 +5411,9 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
     see <xref linkend="release-9-3-9"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6009,10 +6011,10 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-9">
+ <section id="release-9-3-9">
   <title>Release 9.3.9</title>
 
   <formalpara>
@@ -6026,7 +6028,7 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.9</title>
 
    <para>
@@ -6044,9 +6046,9 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
     see <xref linkend="release-9-3-7"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6158,10 +6160,10 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-8">
+ <section id="release-9-3-8">
   <title>Release 9.3.8</title>
 
   <formalpara>
@@ -6175,7 +6177,7 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.8</title>
 
    <para>
@@ -6187,9 +6189,9 @@ Branch: REL9_2_STABLE [37f30b251] 2016-04-18 13:19:52 -0400
     see <xref linkend="release-9-3-7"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6266,10 +6268,10 @@ Branch: REL9_0_STABLE [4dddf8552] 2015-05-21 20:41:55 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-7">
+ <section id="release-9-3-7">
   <title>Release 9.3.7</title>
 
   <formalpara>
@@ -6283,7 +6285,7 @@ Branch: REL9_0_STABLE [4dddf8552] 2015-05-21 20:41:55 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.7</title>
 
    <para>
@@ -6301,9 +6303,9 @@ Branch: REL9_0_STABLE [4dddf8552] 2015-05-21 20:41:55 -0400
     see <xref linkend="release-9-3-6"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6856,10 +6858,10 @@ Branch: REL9_0_STABLE [4dddf8552] 2015-05-21 20:41:55 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-6">
+ <section id="release-9-3-6">
   <title>Release 9.3.6</title>
 
   <formalpara>
@@ -6873,7 +6875,7 @@ Branch: REL9_0_STABLE [4dddf8552] 2015-05-21 20:41:55 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.6</title>
 
    <para>
@@ -6894,9 +6896,9 @@ Branch: REL9_0_STABLE [4dddf8552] 2015-05-21 20:41:55 -0400
     see <xref linkend="release-9-3-5"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -8741,10 +8743,10 @@ Branch: REL9_0_STABLE [b6391f587] 2014-10-04 14:18:43 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-5">
+ <section id="release-9-3-5">
   <title>Release 9.3.5</title>
 
   <formalpara>
@@ -8758,7 +8760,7 @@ Branch: REL9_0_STABLE [b6391f587] 2014-10-04 14:18:43 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.5</title>
 
    <para>
@@ -8778,9 +8780,9 @@ Branch: REL9_0_STABLE [b6391f587] 2014-10-04 14:18:43 -0400
     see <xref linkend="release-9-3-4"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -9861,10 +9863,10 @@ Branch: REL8_4_STABLE [c51da696b] 2014-07-19 15:01:45 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-4">
+ <section id="release-9-3-4">
   <title>Release 9.3.4</title>
 
   <formalpara>
@@ -9878,7 +9880,7 @@ Branch: REL8_4_STABLE [c51da696b] 2014-07-19 15:01:45 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.4</title>
 
    <para>
@@ -9897,9 +9899,9 @@ Branch: REL8_4_STABLE [c51da696b] 2014-07-19 15:01:45 -0400
     see <xref linkend="release-9-3-3"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -10323,10 +10325,10 @@ Branch: REL8_4_STABLE [6e6c2c2e1] 2014-03-15 13:36:57 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-3">
+ <section id="release-9-3-3">
   <title>Release 9.3.3</title>
 
   <formalpara>
@@ -10340,7 +10342,7 @@ Branch: REL8_4_STABLE [6e6c2c2e1] 2014-03-15 13:36:57 -0400
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.3</title>
 
    <para>
@@ -10369,9 +10371,9 @@ Branch: REL8_4_STABLE [6e6c2c2e1] 2014-03-15 13:36:57 -0400
     see <xref linkend="release-9-3-2"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -11785,10 +11787,10 @@ Branch: REL8_4_STABLE [c0c2d62ac] 2014-02-14 21:59:56 -0500
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-2">
+ <section id="release-9-3-2">
   <title>Release 9.3.2</title>
 
   <formalpara>
@@ -11802,7 +11804,7 @@ Branch: REL8_4_STABLE [c0c2d62ac] 2014-02-14 21:59:56 -0500
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.2</title>
 
    <para>
@@ -11820,9 +11822,9 @@ Branch: REL8_4_STABLE [c0c2d62ac] 2014-02-14 21:59:56 -0500
     see <xref linkend="release-9-3-1"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -12264,10 +12266,10 @@ SELECT ... FROM tab1 x CROSS JOIN (tab2 x CROSS JOIN tab3 y) z
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3-1">
+ <section id="release-9-3-1">
   <title>Release 9.3.1</title>
 
   <formalpara>
@@ -12281,7 +12283,7 @@ SELECT ... FROM tab1 x CROSS JOIN (tab2 x CROSS JOIN tab3 y) z
    <xref linkend="release-9-3"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.3.1</title>
 
    <para>
@@ -12293,9 +12295,9 @@ SELECT ... FROM tab1 x CROSS JOIN (tab2 x CROSS JOIN tab3 y) z
     first changelog entry.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -12367,10 +12369,10 @@ ALTER EXTENSION hstore UPDATE;
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-3">
+ <section id="release-9-3">
   <title>Release 9.3</title>
 
   <formalpara>
@@ -12378,7 +12380,7 @@ ALTER EXTENSION hstore UPDATE;
    <para>2013-09-09</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -12468,9 +12470,9 @@ ALTER EXTENSION hstore UPDATE;
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
 
   <title>Migration to Version 9.3</title>
 
@@ -12486,7 +12488,7 @@ ALTER EXTENSION hstore UPDATE;
     with previous releases.  Observe the following incompatibilities:
    </para>
 
-   <sect3>
+   <section>
     <title>Server Settings</title>
 
      <itemizedlist>
@@ -12526,9 +12528,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Other</title>
 
      <itemizedlist>
@@ -12646,11 +12648,11 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -12659,10 +12661,10 @@ ALTER EXTENSION hstore UPDATE;
     release.
    </para>
 
-   <sect3>
+   <section>
     <title>Server</title>
 
-    <sect4>
+    <section>
      <title>Locking</title>
 
      <itemizedlist>
@@ -12696,9 +12698,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Indexes</title>
 
      <itemizedlist>
@@ -12733,9 +12735,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Optimizer</title>
 
      <itemizedlist>
@@ -12778,9 +12780,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>General Performance</title>
 
      <itemizedlist>
@@ -12867,9 +12869,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Monitoring</title>
 
      <itemizedlist>
@@ -12926,9 +12928,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Authentication</title>
 
      <itemizedlist>
@@ -12983,9 +12985,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Server Settings</title>
 
      <itemizedlist>
@@ -13055,11 +13057,11 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Replication and Recovery</title>
 
      <itemizedlist>
@@ -13188,9 +13190,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
 
      <itemizedlist>
@@ -13228,9 +13230,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Manipulation</title>
 
      <itemizedlist>
@@ -13320,7 +13322,7 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title><command>ALTER</command></title>
 
      <itemizedlist>
@@ -13360,9 +13362,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="rules-views"><command>VIEWs</command></link></title>
 
      <itemizedlist>
@@ -13428,11 +13430,11 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
 
     <itemizedlist>
@@ -13460,7 +13462,7 @@ ALTER EXTENSION hstore UPDATE;
 
     </itemizedlist>
 
-   <sect4>
+   <section>
     <title><link linkend="datatype-json"><type>JSON</type></link></title>
 
     <itemizedlist>
@@ -13490,12 +13492,12 @@ ALTER EXTENSION hstore UPDATE;
 
     </itemizedlist>
 
-   </sect4>
+   </section>
 
-   </sect3>
+   </section>
 
 
-   <sect3>
+   <section>
     <title>Functions</title>
 
      <itemizedlist>
@@ -13589,12 +13591,12 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server-Side Languages</title>
 
-    <sect4>
+    <section>
      <title><link linkend="plpgsql">PL/pgSQL</link> Server-Side Language</title>
 
      <itemizedlist>
@@ -13647,9 +13649,9 @@ ALTER EXTENSION hstore UPDATE;
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="plpython">PL/Python</link> Server-Side Language</title>
 
      <itemizedlist>
@@ -13681,11 +13683,11 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Programming Interface (<link linkend="spi">SPI</link>)</title>
 
      <itemizedlist>
@@ -13718,9 +13720,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Applications</title>
 
     <itemizedlist>
@@ -13772,7 +13774,7 @@ ALTER EXTENSION hstore UPDATE;
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="app-psql"><application>psql</application></link></title>
 
      <itemizedlist>
@@ -13817,7 +13819,7 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    <sect5>
+    <section>
      <title><link linkend="app-psql-meta-commands">Backslash Commands</link></title>
 
      <itemizedlist>
@@ -13883,9 +13885,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect5>
+    </section>
 
-    <sect5>
+    <section>
      <title>Output</title>
 
      <itemizedlist>
@@ -13924,11 +13926,11 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect5>
+    </section>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="app-pgdump"><application>pg_dump</application></link></title>
 
      <itemizedlist>
@@ -13967,9 +13969,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="app-initdb"><application>initdb</application></link></title>
 
      <itemizedlist>
@@ -14006,11 +14008,11 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
 
      <itemizedlist>
@@ -14272,9 +14274,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Additional Modules</title>
 
     <itemizedlist>
@@ -14369,7 +14371,7 @@ ALTER EXTENSION hstore UPDATE;
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="pgupgrade"><application>pg_upgrade</application></link></title>
 
      <itemizedlist>
@@ -14430,9 +14432,9 @@ ALTER EXTENSION hstore UPDATE;
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><link linkend="pgbench"><application>pgbench</application></link></title>
 
      <itemizedlist>
@@ -14497,11 +14499,11 @@ ALTER EXTENSION hstore UPDATE;
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Documentation</title>
 
     <itemizedlist>
@@ -14545,7 +14547,8 @@ ALTER EXTENSION hstore UPDATE;
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-9.4.sgml b/doc/src/sgml/release-9.4.sgml
index 9851d96d42..5e572d18c9 100644
--- a/doc/src/sgml/release-9.4.sgml
+++ b/doc/src/sgml/release-9.4.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-9.4.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-9-4-20">
+<section>
+ <title>Release 9.4</title>
+ <section id="release-9-4-20">
   <title>Release 9.4.20</title>
 
   <formalpara>
@@ -15,7 +17,7 @@
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.20</title>
 
    <para>
@@ -26,9 +28,9 @@
     However, if you are upgrading from a version earlier than 9.4.18,
     see <xref linkend="release-9-4-18"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -514,10 +516,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-19">
+ <section id="release-9-4-19">
   <title>Release 9.4.19</title>
 
   <formalpara>
@@ -531,7 +533,7 @@
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.19</title>
 
    <para>
@@ -542,9 +544,9 @@
     However, if you are upgrading from a version earlier than 9.4.18,
     see <xref linkend="release-9-4-18"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -882,10 +884,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-18">
+ <section id="release-9-4-18">
   <title>Release 9.4.18</title>
 
   <formalpara>
@@ -899,7 +901,7 @@
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.18</title>
 
    <para>
@@ -916,9 +918,9 @@
     Also, if you are upgrading from a version earlier than 9.4.17,
     see <xref linkend="release-9-4-17"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1295,10 +1297,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-17">
+ <section id="release-9-4-17">
   <title>Release 9.4.17</title>
 
   <formalpara>
@@ -1312,7 +1314,7 @@
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.17</title>
 
    <para>
@@ -1339,9 +1341,9 @@
     Also, if you are upgrading from a version earlier than 9.4.13,
     see <xref linkend="release-9-4-13"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1481,10 +1483,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-16">
+ <section id="release-9-4-16">
   <title>Release 9.4.16</title>
 
   <formalpara>
@@ -1498,7 +1500,7 @@
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.16</title>
 
    <para>
@@ -1509,9 +1511,9 @@
     However, if you are upgrading from a version earlier than 9.4.13,
     see <xref linkend="release-9-4-13"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1844,10 +1846,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-15">
+ <section id="release-9-4-15">
   <title>Release 9.4.15</title>
 
   <formalpara>
@@ -1861,7 +1863,7 @@
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.15</title>
 
    <para>
@@ -1872,9 +1874,9 @@
     However, if you are upgrading from a version earlier than 9.4.13,
     see <xref linkend="release-9-4-13"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2122,10 +2124,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-14">
+ <section id="release-9-4-14">
   <title>Release 9.4.14</title>
 
   <formalpara>
@@ -2139,7 +2141,7 @@
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.14</title>
 
    <para>
@@ -2150,9 +2152,9 @@
     However, if you are upgrading from a version earlier than 9.4.13,
     see <xref linkend="release-9-4-13"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2309,10 +2311,10 @@ CREATE OR REPLACE VIEW table_privileges AS
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-13">
+ <section id="release-9-4-13">
   <title>Release 9.4.13</title>
 
   <formalpara>
@@ -2326,7 +2328,7 @@ CREATE OR REPLACE VIEW table_privileges AS
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.13</title>
 
    <para>
@@ -2342,9 +2344,9 @@ CREATE OR REPLACE VIEW table_privileges AS
     Also, if you are upgrading from a version earlier than 9.4.12,
     see <xref linkend="release-9-4-12"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2982,10 +2984,10 @@ Branch: REL9_4_STABLE [23a2b818f] 2017-08-05 14:56:40 -0700
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-12">
+ <section id="release-9-4-12">
   <title>Release 9.4.12</title>
 
   <formalpara>
@@ -2999,7 +3001,7 @@ Branch: REL9_4_STABLE [23a2b818f] 2017-08-05 14:56:40 -0700
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.12</title>
 
    <para>
@@ -3020,9 +3022,9 @@ Branch: REL9_4_STABLE [23a2b818f] 2017-08-05 14:56:40 -0700
     Also, if you are upgrading from a version earlier than 9.4.11,
     see <xref linkend="release-9-4-11"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3490,10 +3492,10 @@ Branch: REL9_2_STABLE [fb50c38e9] 2017-04-17 13:52:42 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-11">
+ <section id="release-9-4-11">
   <title>Release 9.4.11</title>
 
   <formalpara>
@@ -3507,7 +3509,7 @@ Branch: REL9_2_STABLE [fb50c38e9] 2017-04-17 13:52:42 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.11</title>
 
    <para>
@@ -3524,9 +3526,9 @@ Branch: REL9_2_STABLE [fb50c38e9] 2017-04-17 13:52:42 -0400
     Also, if you are upgrading from a version earlier than 9.4.10,
     see <xref linkend="release-9-4-10"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4023,10 +4025,10 @@ Branch: REL9_2_STABLE [fb50c38e9] 2017-04-17 13:52:42 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-10">
+ <section id="release-9-4-10">
   <title>Release 9.4.10</title>
 
   <formalpara>
@@ -4040,7 +4042,7 @@ Branch: REL9_2_STABLE [fb50c38e9] 2017-04-17 13:52:42 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.10</title>
 
    <para>
@@ -4057,9 +4059,9 @@ Branch: REL9_2_STABLE [fb50c38e9] 2017-04-17 13:52:42 -0400
     Also, if you are upgrading from a version earlier than 9.4.6,
     see <xref linkend="release-9-4-6"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4489,10 +4491,10 @@ Branch: REL9_4_STABLE [10ad15f48] 2016-09-01 11:45:16 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-9">
+ <section id="release-9-4-9">
   <title>Release 9.4.9</title>
 
   <formalpara>
@@ -4506,7 +4508,7 @@ Branch: REL9_4_STABLE [10ad15f48] 2016-09-01 11:45:16 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.9</title>
 
    <para>
@@ -4517,9 +4519,9 @@ Branch: REL9_4_STABLE [10ad15f48] 2016-09-01 11:45:16 -0400
     However, if you are upgrading from a version earlier than 9.4.6,
     see <xref linkend="release-9-4-6"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5011,10 +5013,10 @@ Branch: REL9_1_STABLE [de887cc8a] 2016-05-25 19:39:49 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-8">
+ <section id="release-9-4-8">
   <title>Release 9.4.8</title>
 
   <formalpara>
@@ -5028,7 +5030,7 @@ Branch: REL9_1_STABLE [de887cc8a] 2016-05-25 19:39:49 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.8</title>
 
    <para>
@@ -5039,9 +5041,9 @@ Branch: REL9_1_STABLE [de887cc8a] 2016-05-25 19:39:49 -0400
     However, if you are upgrading from a version earlier than 9.4.6,
     see <xref linkend="release-9-4-6"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5274,10 +5276,10 @@ Branch: REL9_1_STABLE [de887cc8a] 2016-05-25 19:39:49 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-7">
+ <section id="release-9-4-7">
   <title>Release 9.4.7</title>
 
   <formalpara>
@@ -5291,7 +5293,7 @@ Branch: REL9_1_STABLE [de887cc8a] 2016-05-25 19:39:49 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.7</title>
 
    <para>
@@ -5302,9 +5304,9 @@ Branch: REL9_1_STABLE [de887cc8a] 2016-05-25 19:39:49 -0400
     However, if you are upgrading from a version earlier than 9.4.6,
     see <xref linkend="release-9-4-6"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5545,10 +5547,10 @@ Branch: REL9_1_STABLE [de887cc8a] 2016-05-25 19:39:49 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-6">
+ <section id="release-9-4-6">
   <title>Release 9.4.6</title>
 
   <formalpara>
@@ -5562,7 +5564,7 @@ Branch: REL9_1_STABLE [de887cc8a] 2016-05-25 19:39:49 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.6</title>
 
    <para>
@@ -5579,9 +5581,9 @@ Branch: REL9_1_STABLE [de887cc8a] 2016-05-25 19:39:49 -0400
     Also, if you are upgrading from a version earlier than 9.4.4,
     see <xref linkend="release-9-4-4"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6642,10 +6644,10 @@ Branch: REL9_1_STABLE [386dcd539] 2015-12-11 19:08:40 -0500
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-5">
+ <section id="release-9-4-5">
   <title>Release 9.4.5</title>
 
   <formalpara>
@@ -6659,7 +6661,7 @@ Branch: REL9_1_STABLE [386dcd539] 2015-12-11 19:08:40 -0500
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.5</title>
 
    <para>
@@ -6670,9 +6672,9 @@ Branch: REL9_1_STABLE [386dcd539] 2015-12-11 19:08:40 -0500
     However, if you are upgrading from a version earlier than 9.4.4,
     see <xref linkend="release-9-4-4"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -8165,10 +8167,10 @@ Branch: REL9_0_STABLE [47ac95f37] 2015-10-02 19:16:37 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-4">
+ <section id="release-9-4-4">
   <title>Release 9.4.4</title>
 
   <formalpara>
@@ -8182,7 +8184,7 @@ Branch: REL9_0_STABLE [47ac95f37] 2015-10-02 19:16:37 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.4</title>
 
    <para>
@@ -8199,9 +8201,9 @@ Branch: REL9_0_STABLE [47ac95f37] 2015-10-02 19:16:37 -0400
     Also, if you are upgrading from a version earlier than 9.4.2,
     see <xref linkend="release-9-4-2"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -8346,10 +8348,10 @@ Branch: REL9_3_STABLE [d3fdec6ae] 2015-06-03 11:58:47 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-3">
+ <section id="release-9-4-3">
   <title>Release 9.4.3</title>
 
   <formalpara>
@@ -8363,7 +8365,7 @@ Branch: REL9_3_STABLE [d3fdec6ae] 2015-06-03 11:58:47 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.3</title>
 
    <para>
@@ -8374,9 +8376,9 @@ Branch: REL9_3_STABLE [d3fdec6ae] 2015-06-03 11:58:47 -0400
     However, if you are upgrading from a version earlier than 9.4.2,
     see <xref linkend="release-9-4-2"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -8489,10 +8491,10 @@ Branch: REL9_0_STABLE [b06649b7f] 2015-05-26 22:15:00 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-2">
+ <section id="release-9-4-2">
   <title>Release 9.4.2</title>
 
   <formalpara>
@@ -8506,7 +8508,7 @@ Branch: REL9_0_STABLE [b06649b7f] 2015-05-26 22:15:00 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.2</title>
 
    <para>
@@ -8523,9 +8525,9 @@ Branch: REL9_0_STABLE [b06649b7f] 2015-05-26 22:15:00 -0400
     Also, if you are upgrading from a version earlier than 9.4.1,
     see <xref linkend="release-9-4-1"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -9770,10 +9772,10 @@ Branch: REL9_0_STABLE [3c3749a3b] 2015-05-15 19:36:20 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4-1">
+ <section id="release-9-4-1">
   <title>Release 9.4.1</title>
 
   <formalpara>
@@ -9787,7 +9789,7 @@ Branch: REL9_0_STABLE [3c3749a3b] 2015-05-15 19:36:20 -0400
    <xref linkend="release-9-4"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.4.1</title>
 
    <para>
@@ -9803,9 +9805,9 @@ Branch: REL9_0_STABLE [3c3749a3b] 2015-05-15 19:36:20 -0400
     alias <quote>Norwegian_Norway</quote>.  For details see
     <ulink url="http://wiki.postgresql.org/wiki/Changes_To_Norwegian_Locale"></ulink>
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -10583,10 +10585,10 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-4">
+ <section id="release-9-4">
   <title>Release 9.4</title>
 
   <formalpara>
@@ -10594,7 +10596,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
    <para>2014-12-18</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -10654,9 +10656,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
 
   <title>Migration to Version 9.4</title>
 
@@ -10985,9 +10987,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
    </itemizedlist>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -10996,7 +10998,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
     release.
    </para>
 
-   <sect3>
+   <section>
     <title>Server</title>
 
      <itemizedlist>
@@ -11059,7 +11061,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title>Indexes</title>
 
      <itemizedlist>
@@ -11116,9 +11118,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>General Performance</title>
 
      <itemizedlist>
@@ -11236,9 +11238,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Monitoring</title>
 
      <itemizedlist>
@@ -11276,9 +11278,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><acronym>SSL</acronym></title>
 
      <itemizedlist>
@@ -11337,9 +11339,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Server Settings</title>
 
      <itemizedlist>
@@ -11485,11 +11487,11 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Replication and Recovery</title>
 
      <itemizedlist>
@@ -11585,7 +11587,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-     <sect4>
+     <section>
       <title><link linkend="logicaldecoding">Logical Decoding</link></title>
 
       <para>
@@ -11648,11 +11650,11 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
       </itemizedlist>
 
-     </sect4>
+     </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
 
      <itemizedlist>
@@ -11701,9 +11703,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Commands</title>
 
      <itemizedlist>
@@ -11750,7 +11752,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-     <sect4>
+     <section>
       <title><xref linkend="sql-explain"/></title>
 
       <itemizedlist>
@@ -11778,9 +11780,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
       </itemizedlist>
 
-     </sect4>
+     </section>
 
-     <sect4>
+     <section>
       <title>Views</title>
 
       <itemizedlist>
@@ -11838,11 +11840,11 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
       </itemizedlist>
 
-     </sect4>
+     </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Manipulation</title>
 
      <itemizedlist>
@@ -11933,9 +11935,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
 
     <itemizedlist>
@@ -12011,7 +12013,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="datatype-json"><acronym>JSON</acronym></link></title>
 
      <itemizedlist>
@@ -12059,11 +12061,11 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
 
      <itemizedlist>
@@ -12170,7 +12172,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title>System Information Functions</title>
 
      <itemizedlist>
@@ -12224,9 +12226,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Aggregates</title>
 
      <itemizedlist>
@@ -12281,11 +12283,11 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server-Side Languages</title>
 
     <itemizedlist>
@@ -12312,7 +12314,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="plpgsql">PL/pgSQL</link> Server-Side Language</title>
 
      <itemizedlist>
@@ -12350,11 +12352,11 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title><link linkend="libpq"><application>libpq</application></link></title>
      <itemizedlist>
 
@@ -12380,9 +12382,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Applications</title>
 
     <itemizedlist>
@@ -12465,7 +12467,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><xref linkend="app-psql"/></title>
 
      <itemizedlist>
@@ -12487,7 +12489,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-     <sect5>
+     <section>
       <title><link linkend="app-psql-meta-commands">Backslash Commands</link></title>
 
       <itemizedlist>
@@ -12593,11 +12595,11 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
       </itemizedlist>
 
-     </sect5>
+     </section>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><xref linkend="app-pgdump"/></title>
 
      <itemizedlist>
@@ -12632,9 +12634,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><xref linkend="app-pgbasebackup"/></title>
 
      <itemizedlist>
@@ -12672,11 +12674,11 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
 
      <itemizedlist>
@@ -12917,9 +12919,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Additional Modules</title>
 
     <itemizedlist>
@@ -13050,7 +13052,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><xref linkend="pgbench"/></title>
 
      <itemizedlist>
@@ -13089,9 +13091,9 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><xref linkend="pgstatstatements"/></title>
 
      <itemizedlist>
@@ -13150,9 +13152,10 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-9.5.sgml b/doc/src/sgml/release-9.5.sgml
index 00d5619a0a..a01ef05aa0 100644
--- a/doc/src/sgml/release-9.5.sgml
+++ b/doc/src/sgml/release-9.5.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-9.5.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-9-5-15">
+<section>
+ <title>Release 9.5</title>
+ <section id="release-9-5-15">
   <title>Release 9.5.15</title>
 
   <formalpara>
@@ -15,7 +17,7 @@
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.15</title>
 
    <para>
@@ -26,9 +28,9 @@
     However, if you are upgrading from a version earlier than 9.5.13,
     see <xref linkend="release-9-5-13"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -638,10 +640,10 @@ Branch: REL9_3_STABLE [01187f32c] 2018-10-12 14:49:33 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-14">
+ <section id="release-9-5-14">
   <title>Release 9.5.14</title>
 
   <formalpara>
@@ -655,7 +657,7 @@ Branch: REL9_3_STABLE [01187f32c] 2018-10-12 14:49:33 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.14</title>
 
    <para>
@@ -666,9 +668,9 @@ Branch: REL9_3_STABLE [01187f32c] 2018-10-12 14:49:33 -0400
     However, if you are upgrading from a version earlier than 9.5.13,
     see <xref linkend="release-9-5-13"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1060,10 +1062,10 @@ Branch: REL9_3_STABLE [01187f32c] 2018-10-12 14:49:33 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-13">
+ <section id="release-9-5-13">
   <title>Release 9.5.13</title>
 
   <formalpara>
@@ -1077,7 +1079,7 @@ Branch: REL9_3_STABLE [01187f32c] 2018-10-12 14:49:33 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.13</title>
 
    <para>
@@ -1094,9 +1096,9 @@ Branch: REL9_3_STABLE [01187f32c] 2018-10-12 14:49:33 -0400
     Also, if you are upgrading from a version earlier than 9.5.12,
     see <xref linkend="release-9-5-12"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1532,10 +1534,10 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-12">
+ <section id="release-9-5-12">
   <title>Release 9.5.12</title>
 
   <formalpara>
@@ -1549,7 +1551,7 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.12</title>
 
    <para>
@@ -1576,9 +1578,9 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
     Also, if you are upgrading from a version earlier than 9.5.10,
     see <xref linkend="release-9-5-10"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1718,10 +1720,10 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-11">
+ <section id="release-9-5-11">
   <title>Release 9.5.11</title>
 
   <formalpara>
@@ -1735,7 +1737,7 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.11</title>
 
    <para>
@@ -1746,9 +1748,9 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
     However, if you are upgrading from a version earlier than 9.5.10,
     see <xref linkend="release-9-5-10"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2133,10 +2135,10 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-10">
+ <section id="release-9-5-10">
   <title>Release 9.5.10</title>
 
   <formalpara>
@@ -2150,7 +2152,7 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.10</title>
 
    <para>
@@ -2165,9 +2167,9 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
     Also, if you are upgrading from a version earlier than 9.5.8,
     see <xref linkend="release-9-5-8"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2494,10 +2496,10 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-9">
+ <section id="release-9-5-9">
   <title>Release 9.5.9</title>
 
   <formalpara>
@@ -2511,7 +2513,7 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.9</title>
 
    <para>
@@ -2522,9 +2524,9 @@ Branch: REL9_5_STABLE [3c0e07a46] 2018-05-01 12:02:41 -0400
     However, if you are upgrading from a version earlier than 9.5.8,
     see <xref linkend="release-9-5-8"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2671,10 +2673,10 @@ CREATE OR REPLACE VIEW table_privileges AS
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-8">
+ <section id="release-9-5-8">
   <title>Release 9.5.8</title>
 
   <formalpara>
@@ -2688,7 +2690,7 @@ CREATE OR REPLACE VIEW table_privileges AS
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.8</title>
 
    <para>
@@ -2704,9 +2706,9 @@ CREATE OR REPLACE VIEW table_privileges AS
     Also, if you are upgrading from a version earlier than 9.5.7,
     see <xref linkend="release-9-5-7"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3378,10 +3380,10 @@ Branch: REL9_2_STABLE [1188b9b2c] 2017-08-02 15:07:21 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-7">
+ <section id="release-9-5-7">
   <title>Release 9.5.7</title>
 
   <formalpara>
@@ -3395,7 +3397,7 @@ Branch: REL9_2_STABLE [1188b9b2c] 2017-08-02 15:07:21 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.7</title>
 
    <para>
@@ -3416,9 +3418,9 @@ Branch: REL9_2_STABLE [1188b9b2c] 2017-08-02 15:07:21 -0400
     Also, if you are upgrading from a version earlier than 9.5.6,
     see <xref linkend="release-9-5-6"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3947,10 +3949,10 @@ Branch: REL9_3_STABLE [3aa16b117] 2017-05-06 22:17:35 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-6">
+ <section id="release-9-5-6">
   <title>Release 9.5.6</title>
 
   <formalpara>
@@ -3964,7 +3966,7 @@ Branch: REL9_3_STABLE [3aa16b117] 2017-05-06 22:17:35 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.6</title>
 
    <para>
@@ -3981,9 +3983,9 @@ Branch: REL9_3_STABLE [3aa16b117] 2017-05-06 22:17:35 -0400
     Also, if you are upgrading from a version earlier than 9.5.5,
     see <xref linkend="release-9-5-5"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4609,10 +4611,10 @@ Branch: REL9_2_STABLE [60314e28e] 2016-12-13 19:08:09 -0600
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-5">
+ <section id="release-9-5-5">
   <title>Release 9.5.5</title>
 
   <formalpara>
@@ -4626,7 +4628,7 @@ Branch: REL9_2_STABLE [60314e28e] 2016-12-13 19:08:09 -0600
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.5</title>
 
    <para>
@@ -4643,9 +4645,9 @@ Branch: REL9_2_STABLE [60314e28e] 2016-12-13 19:08:09 -0600
     Also, if you are upgrading from a version earlier than 9.5.2,
     see <xref linkend="release-9-5-2"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5433,10 +5435,10 @@ Branch: REL9_1_STABLE [380dad29d] 2016-09-02 17:29:32 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-4">
+ <section id="release-9-5-4">
   <title>Release 9.5.4</title>
 
   <formalpara>
@@ -5450,7 +5452,7 @@ Branch: REL9_1_STABLE [380dad29d] 2016-09-02 17:29:32 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.4</title>
 
    <para>
@@ -5461,9 +5463,9 @@ Branch: REL9_1_STABLE [380dad29d] 2016-09-02 17:29:32 -0400
     However, if you are upgrading from a version earlier than 9.5.2,
     see <xref linkend="release-9-5-2"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6506,10 +6508,10 @@ Branch: REL9_1_STABLE [a44388ffe] 2016-08-05 12:59:02 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-3">
+ <section id="release-9-5-3">
   <title>Release 9.5.3</title>
 
   <formalpara>
@@ -6523,7 +6525,7 @@ Branch: REL9_1_STABLE [a44388ffe] 2016-08-05 12:59:02 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.3</title>
 
    <para>
@@ -6534,9 +6536,9 @@ Branch: REL9_1_STABLE [a44388ffe] 2016-08-05 12:59:02 -0400
     However, if you are upgrading from a version earlier than 9.5.2,
     see <xref linkend="release-9-5-2"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7007,10 +7009,10 @@ Branch: REL9_1_STABLE [bfc39da64] 2016-05-05 20:09:32 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-2">
+ <section id="release-9-5-2">
   <title>Release 9.5.2</title>
 
   <formalpara>
@@ -7024,7 +7026,7 @@ Branch: REL9_1_STABLE [bfc39da64] 2016-05-05 20:09:32 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.2</title>
 
    <para>
@@ -7035,9 +7037,9 @@ Branch: REL9_1_STABLE [bfc39da64] 2016-05-05 20:09:32 -0400
     However, you may need to <command>REINDEX</command> some indexes after applying
     the update, as per the first changelog entry below.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7718,10 +7720,10 @@ Branch: REL9_1_STABLE [e5fd35cc5] 2016-03-25 19:03:54 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5-1">
+ <section id="release-9-5-1">
   <title>Release 9.5.1</title>
 
   <formalpara>
@@ -7735,15 +7737,15 @@ Branch: REL9_1_STABLE [e5fd35cc5] 2016-03-25 19:03:54 -0400
    <xref linkend="release-9-5"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.5.1</title>
 
    <para>
     A dump/restore is not required for those running 9.5.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -8166,10 +8168,10 @@ Branch: REL9_1_STABLE [6887d72d0] 2016-02-05 10:59:39 -0500
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-5">
+ <section id="release-9-5">
   <title>Release 9.5</title>
 
   <formalpara>
@@ -8177,7 +8179,7 @@ Branch: REL9_1_STABLE [6887d72d0] 2016-02-05 10:59:39 -0500
    <para>2016-01-07</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -8244,9 +8246,9 @@ Branch: REL9_1_STABLE [6887d72d0] 2016-02-05 10:59:39 -0500
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
 
   <title>Migration to Version 9.5</title>
 
@@ -8469,9 +8471,9 @@ max_wal_size = (3 * checkpoint_segments) * 16MB
 
    </itemizedlist>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -8480,10 +8482,10 @@ max_wal_size = (3 * checkpoint_segments) * 16MB
     release.
    </para>
 
-   <sect3>
+   <section>
     <title>Server</title>
 
-    <sect4>
+    <section>
      <title>Indexes</title>
 
      <itemizedlist>
@@ -8570,9 +8572,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>General Performance</title>
 
      <itemizedlist>
@@ -8766,9 +8768,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Monitoring</title>
 
      <itemizedlist>
@@ -8814,9 +8816,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><acronym>SSL</acronym></title>
 
      <itemizedlist>
@@ -8888,9 +8890,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Server Settings</title>
 
      <itemizedlist>
@@ -9049,11 +9051,11 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Replication and Recovery</title>
 
      <itemizedlist>
@@ -9207,9 +9209,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
 
      <itemizedlist>
@@ -9307,9 +9309,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Commands</title>
 
      <itemizedlist>
@@ -9352,7 +9354,7 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
        </itemizedlist>
 
-       <sect4>
+       <section>
         <title><xref linkend="sql-reindex"/></title>
 
         <itemizedlist>
@@ -9400,10 +9402,10 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
       </itemizedlist>
 
-     </sect4>
-   </sect3>
+     </section>
+   </section>
 
-   <sect3>
+   <section>
     <title>Object Manipulation</title>
 
      <itemizedlist>
@@ -9560,7 +9562,7 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-     <sect4>
+     <section>
       <title><link linkend="ddl-foreign-data">Foreign Tables</link></title>
 
       <itemizedlist>
@@ -9628,9 +9630,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-     </sect4>
+     </section>
 
-     <sect4>
+     <section>
       <title><link linkend="event-triggers">Event Triggers</link></title>
 
       <itemizedlist>
@@ -9695,11 +9697,11 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
       </itemizedlist>
 
-     </sect4>
+     </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
 
     <itemizedlist>
@@ -9776,7 +9778,7 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="datatype-json"><acronym>JSON</acronym></link></title>
 
      <itemizedlist>
@@ -9869,11 +9871,11 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
 
      <itemizedlist>
@@ -9992,7 +9994,7 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title>System Information Functions and Views</title>
 
      <itemizedlist>
@@ -10061,9 +10063,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
       </listitem>
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Aggregates</title>
 
      <itemizedlist>
@@ -10093,11 +10095,11 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server-Side Languages</title>
 
     <itemizedlist>
@@ -10152,7 +10154,7 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-     <sect4>
+     <section>
       <title><link linkend="plpgsql">PL/pgSQL</link> Server-Side Language</title>
 
       <itemizedlist>
@@ -10192,11 +10194,11 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
     </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Applications</title>
 
     <itemizedlist>
@@ -10323,7 +10325,7 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
     </itemizedlist>
 
-     <sect4>
+     <section>
       <title><xref linkend="app-psql"/></title>
 
       <itemizedlist>
@@ -10443,7 +10445,7 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
       </itemizedlist>
 
-     <sect5>
+     <section>
       <title><link linkend="app-psql-meta-commands">Backslash Commands</link></title>
 
       <itemizedlist>
@@ -10535,11 +10537,11 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
       </itemizedlist>
 
-     </sect5>
+     </section>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><xref linkend="app-pgdump"/></title>
 
      <itemizedlist>
@@ -10605,9 +10607,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><xref linkend="app-pg-ctl"/></title>
 
      <itemizedlist>
@@ -10656,9 +10658,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><xref linkend="pgupgrade"/></title>
 
      <itemizedlist>
@@ -10711,9 +10713,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><xref linkend="pgbench"/></title>
 
      <itemizedlist>
@@ -10784,11 +10786,11 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
 
      <itemizedlist>
@@ -10963,7 +10965,7 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    <sect4>
+    <section>
      <title>MS Windows</title>
 
      <itemizedlist>
@@ -11054,11 +11056,11 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Additional Modules</title>
 
     <itemizedlist>
@@ -11184,8 +11186,9 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-  </sect2>
+  </section>
 
- </sect1>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-9.6.sgml b/doc/src/sgml/release-9.6.sgml
index acebcc6249..710f142360 100644
--- a/doc/src/sgml/release-9.6.sgml
+++ b/doc/src/sgml/release-9.6.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-9.6.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-9-6-11">
+<section>
+ <title>Release 9.6</title>
+ <section id="release-9-6-11">
   <title>Release 9.6.11</title>
 
   <formalpara>
@@ -15,7 +17,7 @@
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.11</title>
 
    <para>
@@ -26,9 +28,9 @@
     However, if you are upgrading from a version earlier than 9.6.9,
     see <xref linkend="release-9-6-9"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -680,10 +682,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-10">
+ <section id="release-9-6-10">
   <title>Release 9.6.10</title>
 
   <formalpara>
@@ -697,7 +699,7 @@
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.10</title>
 
    <para>
@@ -708,9 +710,9 @@
     However, if you are upgrading from a version earlier than 9.6.9,
     see <xref linkend="release-9-6-9"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1126,10 +1128,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-9">
+ <section id="release-9-6-9">
   <title>Release 9.6.9</title>
 
   <formalpara>
@@ -1143,7 +1145,7 @@
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.9</title>
 
    <para>
@@ -1165,9 +1167,9 @@
     Also, if you are upgrading from a version earlier than 9.6.8,
     see <xref linkend="release-9-6-8"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1691,10 +1693,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-8">
+ <section id="release-9-6-8">
   <title>Release 9.6.8</title>
 
   <formalpara>
@@ -1708,7 +1710,7 @@
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.8</title>
 
    <para>
@@ -1735,9 +1737,9 @@
     Also, if you are upgrading from a version earlier than 9.6.7,
     see <xref linkend="release-9-6-7"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -1884,10 +1886,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-7">
+ <section id="release-9-6-7">
   <title>Release 9.6.7</title>
 
   <formalpara>
@@ -1901,7 +1903,7 @@
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.7</title>
 
    <para>
@@ -1918,9 +1920,9 @@
     Also, if you are upgrading from a version earlier than 9.6.6,
     see <xref linkend="release-9-6-6"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2363,10 +2365,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-6">
+ <section id="release-9-6-6">
   <title>Release 9.6.6</title>
 
   <formalpara>
@@ -2380,7 +2382,7 @@
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.6</title>
 
    <para>
@@ -2395,9 +2397,9 @@
     Also, if you are upgrading from a version earlier than 9.6.4,
     see <xref linkend="release-9-6-4"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -2942,10 +2944,10 @@ Branch: REL9_2_STABLE [1317d1301] 2017-10-23 17:54:09 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-5">
+ <section id="release-9-6-5">
   <title>Release 9.6.5</title>
 
   <formalpara>
@@ -2959,7 +2961,7 @@ Branch: REL9_2_STABLE [1317d1301] 2017-10-23 17:54:09 -0400
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.5</title>
 
    <para>
@@ -2970,9 +2972,9 @@ Branch: REL9_2_STABLE [1317d1301] 2017-10-23 17:54:09 -0400
     However, if you are upgrading from a version earlier than 9.6.4,
     see <xref linkend="release-9-6-4"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -3221,10 +3223,10 @@ Branch: REL9_5_STABLE [a784d5f21] 2017-08-09 12:06:14 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-4">
+ <section id="release-9-6-4">
   <title>Release 9.6.4</title>
 
   <formalpara>
@@ -3238,7 +3240,7 @@ Branch: REL9_5_STABLE [a784d5f21] 2017-08-09 12:06:14 -0400
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.4</title>
 
    <para>
@@ -3254,9 +3256,9 @@ Branch: REL9_5_STABLE [a784d5f21] 2017-08-09 12:06:14 -0400
     Also, if you are upgrading from a version earlier than 9.6.3,
     see <xref linkend="release-9-6-3"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -4502,10 +4504,10 @@ Branch: REL9_4_STABLE [9c3f502b4] 2017-07-16 11:27:15 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-3">
+ <section id="release-9-6-3">
   <title>Release 9.6.3</title>
 
   <formalpara>
@@ -4519,7 +4521,7 @@ Branch: REL9_4_STABLE [9c3f502b4] 2017-07-16 11:27:15 -0400
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.3</title>
 
    <para>
@@ -4540,9 +4542,9 @@ Branch: REL9_4_STABLE [9c3f502b4] 2017-07-16 11:27:15 -0400
     Also, if you are upgrading from a version earlier than 9.6.2,
     see <xref linkend="release-9-6-2"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -5554,10 +5556,10 @@ Branch: REL9_2_STABLE [82e7d3dfd] 2017-05-07 11:57:41 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-2">
+ <section id="release-9-6-2">
   <title>Release 9.6.2</title>
 
   <formalpara>
@@ -5571,7 +5573,7 @@ Branch: REL9_2_STABLE [82e7d3dfd] 2017-05-07 11:57:41 -0400
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.2</title>
 
    <para>
@@ -5588,9 +5590,9 @@ Branch: REL9_2_STABLE [82e7d3dfd] 2017-05-07 11:57:41 -0400
     Also, if you are upgrading from a version earlier than 9.6.1,
     see <xref linkend="release-9-6-1"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -6971,10 +6973,10 @@ Branch: REL9_2_STABLE [ef878cc2c] 2017-01-30 11:41:09 -0500
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6-1">
+ <section id="release-9-6-1">
   <title>Release 9.6.1</title>
 
   <formalpara>
@@ -6988,7 +6990,7 @@ Branch: REL9_2_STABLE [ef878cc2c] 2017-01-30 11:41:09 -0500
    <xref linkend="release-9-6"/>.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 9.6.1</title>
 
    <para>
@@ -7001,9 +7003,9 @@ Branch: REL9_2_STABLE [ef878cc2c] 2017-01-30 11:41:09 -0500
     to take action to repair corrupted free space maps and/or visibility
     maps.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -7566,10 +7568,10 @@ Branch: REL9_1_STABLE [22cf97635] 2016-10-19 17:57:06 -0400
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-9-6">
+ <section id="release-9-6">
   <title>Release 9.6</title>
 
   <formalpara>
@@ -7577,7 +7579,7 @@ Branch: REL9_1_STABLE [22cf97635] 2016-10-19 17:57:06 -0400
    <para>2016-09-29</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Overview</title>
 
    <para>
@@ -7633,9 +7635,9 @@ Branch: REL9_1_STABLE [22cf97635] 2016-10-19 17:57:06 -0400
     The above items are explained in more detail in the sections below.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
 
   <title>Migration to Version 9.6</title>
 
@@ -7892,9 +7894,9 @@ and many others in the same vein
 
    </itemizedlist>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -7903,10 +7905,10 @@ and many others in the same vein
     release.
    </para>
 
-   <sect3>
+   <section>
     <title>Server</title>
 
-    <sect4>
+    <section>
      <title>Parallel Queries</title>
 
      <itemizedlist>
@@ -7980,9 +7982,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Indexes</title>
 
      <itemizedlist>
@@ -8061,9 +8063,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Sorting</title>
 
      <itemizedlist>
@@ -8134,9 +8136,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Locking</title>
 
      <itemizedlist>
@@ -8210,9 +8212,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Optimizer Statistics</title>
 
      <itemizedlist>
@@ -8272,9 +8274,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><command>VACUUM</command></title>
 
      <itemizedlist>
@@ -8329,9 +8331,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>General Performance</title>
 
      <itemizedlist>
@@ -8627,9 +8629,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Monitoring</title>
 
      <itemizedlist>
@@ -8767,9 +8769,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><acronym>Authentication</acronym></title>
 
      <itemizedlist>
@@ -8844,9 +8846,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Server Configuration</title>
 
      <itemizedlist>
@@ -8972,9 +8974,9 @@ and many others in the same vein
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title>Reliability</title>
 
      <itemizedlist>
@@ -9058,11 +9060,11 @@ XXX this is pending backpatch, may need to remove
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Replication and Recovery</title>
 
      <itemizedlist>
@@ -9157,9 +9159,9 @@ XXX this is pending backpatch, may need to remove
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Queries</title>
 
      <itemizedlist>
@@ -9285,9 +9287,9 @@ XXX this is pending backpatch, may need to remove
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Utility Commands</title>
 
      <itemizedlist>
@@ -9473,9 +9475,9 @@ XXX this is pending backpatch, may need to remove
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Permissions Management</title>
 
     <itemizedlist>
@@ -9520,9 +9522,9 @@ XXX this is pending backpatch, may need to remove
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Data Types</title>
 
     <itemizedlist>
@@ -9673,9 +9675,9 @@ XXX this is pending backpatch, may need to remove
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Functions</title>
 
      <itemizedlist>
@@ -9961,9 +9963,9 @@ XXX this is pending backpatch, may need to remove
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server-Side Languages</title>
 
     <itemizedlist>
@@ -10068,9 +10070,9 @@ XXX this is pending backpatch, may need to remove
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Interfaces</title>
 
     <itemizedlist>
@@ -10159,9 +10161,9 @@ This commit is also listed under psql and PL/pgSQL
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Client Applications</title>
 
     <itemizedlist>
@@ -10235,7 +10237,7 @@ This commit is also listed under psql and PL/pgSQL
 
     </itemizedlist>
 
-     <sect4>
+     <section>
       <title><xref linkend="app-psql"/></title>
 
       <itemizedlist>
@@ -10435,9 +10437,9 @@ This commit is also listed under libpq and PL/pgSQL
 
       </itemizedlist>
 
-    </sect4>
+    </section>
 
-    <sect4>
+    <section>
      <title><xref linkend="pgbench"/></title>
 
      <itemizedlist>
@@ -10583,11 +10585,11 @@ This commit is also listed under libpq and PL/pgSQL
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Server Applications</title>
 
     <itemizedlist>
@@ -10640,9 +10642,9 @@ This commit is also listed under libpq and PL/pgSQL
 
     </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Source Code</title>
 
      <itemizedlist>
@@ -11035,9 +11037,9 @@ This commit is also listed under libpq and PL/pgSQL
 
      </itemizedlist>
 
-   </sect3>
+   </section>
 
-   <sect3>
+   <section>
     <title>Additional Modules</title>
 
     <itemizedlist>
@@ -11228,7 +11230,7 @@ This commit is also listed under libpq and PL/pgSQL
 
     </itemizedlist>
 
-    <sect4>
+    <section>
      <title><link linkend="postgres-fdw"><filename>postgres_fdw</filename></link></title>
 
      <itemizedlist>
@@ -11332,10 +11334,11 @@ This commit is also listed under libpq and PL/pgSQL
 
      </itemizedlist>
 
-    </sect4>
+    </section>
 
-   </sect3>
+   </section>
 
-  </sect2>
+  </section>
 
- </sect1>
+ </section>
+</section>
diff --git a/doc/src/sgml/release-old.sgml b/doc/src/sgml/release-old.sgml
index d55209d85b..5f0d04f5b1 100644
--- a/doc/src/sgml/release-old.sgml
+++ b/doc/src/sgml/release-old.sgml
@@ -1,7 +1,9 @@
 <!-- doc/src/sgml/release-old.sgml -->
 <!-- See header comment in release.sgml about typical markup -->
 
- <sect1 id="release-7-3-21">
+<section>
+ <title>Release 7.3 and older</title>
+ <section id="release-7-3-21">
   <title>Release 7.3.21</title>
 
   <formalpara>
@@ -20,7 +22,7 @@
    release branch soon.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.21</title>
 
    <para>
@@ -29,9 +31,9 @@
     see <xref linkend="release-7-3-13"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -110,10 +112,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-20">
+ <section id="release-7-3-20">
   <title>Release 7.3.20</title>
 
   <formalpara>
@@ -125,7 +127,7 @@
    This release contains fixes from 7.3.19.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.20</title>
 
    <para>
@@ -134,9 +136,9 @@
     see <xref linkend="release-7-3-13"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -171,10 +173,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-19">
+ <section id="release-7-3-19">
   <title>Release 7.3.19</title>
 
   <formalpara>
@@ -187,7 +189,7 @@
    including a security fix.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.19</title>
 
    <para>
@@ -196,9 +198,9 @@
     see <xref linkend="release-7-3-13"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -227,10 +229,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-18">
+ <section id="release-7-3-18">
   <title>Release 7.3.18</title>
 
   <formalpara>
@@ -243,7 +245,7 @@
    a security fix.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.18</title>
 
    <para>
@@ -252,9 +254,9 @@
     see <xref linkend="release-7-3-13"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -289,10 +291,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-17">
+ <section id="release-7-3-17">
   <title>Release 7.3.17</title>
 
   <formalpara>
@@ -304,7 +306,7 @@
    This release contains a variety of fixes from 7.3.16.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.17</title>
 
    <para>
@@ -313,9 +315,9 @@
     see <xref linkend="release-7-3-13"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <itemizedlist>
@@ -345,10 +347,10 @@
 
    </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-16">
+ <section id="release-7-3-16">
   <title>Release 7.3.16</title>
 
   <formalpara>
@@ -360,7 +362,7 @@
    This release contains a variety of fixes from 7.3.15.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.16</title>
 
    <para>
@@ -369,9 +371,9 @@
     see <xref linkend="release-7-3-13"/>.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -387,10 +389,10 @@
 </para> </listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-15">
+ <section id="release-7-3-15">
   <title>Release 7.3.15</title>
 
   <formalpara>
@@ -403,7 +405,7 @@
    including patches for extremely serious security issues.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.15</title>
 
    <para>
@@ -423,9 +425,9 @@
     <function>PQescapeStringConn()</function>) to perform string escaping,
     rather than relying on <foreignphrase>ad hoc</foreignphrase> code to do it.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -479,10 +481,10 @@ Fuhr)</para></listitem>
 <listitem><para>Fix various minor memory leaks</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-14">
+ <section id="release-7-3-14">
   <title>Release 7.3.14</title>
 
   <formalpara>
@@ -494,7 +496,7 @@ Fuhr)</para></listitem>
    This release contains a variety of fixes from 7.3.13.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.14</title>
 
    <para>
@@ -502,9 +504,9 @@ Fuhr)</para></listitem>
     if you are upgrading from a version earlier than 7.3.13,
     see <xref linkend="release-7-3-13"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -536,10 +538,10 @@ and <function>isinf</function> during configure (Tom)</para></listitem>
 
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-13">
+ <section id="release-7-3-13">
   <title>Release 7.3.13</title>
 
   <formalpara>
@@ -551,7 +553,7 @@ and <function>isinf</function> during configure (Tom)</para></listitem>
    This release contains a variety of fixes from 7.3.12.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.13</title>
 
    <para>
@@ -562,9 +564,9 @@ and <function>isinf</function> during configure (Tom)</para></listitem>
     columns after updating, if you are affected by the locale or
     <application>plperl</application> issues described below.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -598,10 +600,10 @@ what's actually returned by the query (Joe)</para></listitem>
 
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-12">
+ <section id="release-7-3-12">
   <title>Release 7.3.12</title>
 
   <formalpara>
@@ -613,7 +615,7 @@ what's actually returned by the query (Joe)</para></listitem>
    This release contains a variety of fixes from 7.3.11.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.12</title>
 
    <para>
@@ -621,9 +623,9 @@ what's actually returned by the query (Joe)</para></listitem>
     if you are upgrading from a version earlier than 7.3.10,
     see <xref linkend="release-7-3-10"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -645,10 +647,10 @@ table has been dropped</para></listitem>
 
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-11">
+ <section id="release-7-3-11">
   <title>Release 7.3.11</title>
 
   <formalpara>
@@ -660,7 +662,7 @@ table has been dropped</para></listitem>
    This release contains a variety of fixes from 7.3.10.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.11</title>
 
    <para>
@@ -668,9 +670,9 @@ table has been dropped</para></listitem>
     if you are upgrading from a version earlier than 7.3.10,
     see <xref linkend="release-7-3-10"/>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -696,10 +698,10 @@ enabled</para></listitem>
 the variable is of pass-by-reference type</para></listitem>
 </itemizedlist>
 
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-3-10">
+ <section id="release-7-3-10">
   <title>Release 7.3.10</title>
 
   <formalpara>
@@ -712,7 +714,7 @@ the variable is of pass-by-reference type</para></listitem>
    security-related issues.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.10</title>
 
    <para>
@@ -773,9 +775,9 @@ VACUUM FREEZE;
 UPDATE pg_database SET datallowconn = false WHERE datname = 'template0';
 </programlisting>
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -822,10 +824,10 @@ month-related formats</para></listitem>
 <type>RECORD</type></para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-3-9">
+ <section id="release-7-3-9">
   <title>Release 7.3.9</title>
 
   <formalpara>
@@ -838,15 +840,15 @@ month-related formats</para></listitem>
    security-related issues.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.9</title>
 
    <para>
     A dump/restore is not required for those running 7.3.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -878,10 +880,10 @@ in case of nested merge joins could give outright wrong answers.
 datestyles</para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-3-8">
+ <section id="release-7-3-8">
   <title>Release 7.3.8</title>
 
   <formalpara>
@@ -894,15 +896,15 @@ datestyles</para></listitem>
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.8</title>
 
    <para>
     A dump/restore is not required for those running 7.3.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -928,10 +930,10 @@ concern since there is no reason for non-developers to use this script anyway.
 </para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-3-7">
+ <section id="release-7-3-7">
   <title>Release 7.3.7</title>
 
   <formalpara>
@@ -944,15 +946,15 @@ concern since there is no reason for non-developers to use this script anyway.
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.7</title>
 
    <para>
     A dump/restore is not required for those running 7.3.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -968,10 +970,10 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Properly schema-qualify function names when pg_dump'ing a CAST</para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-3-6">
+ <section id="release-7-3-6">
   <title>Release 7.3.6</title>
 
   <formalpara>
@@ -984,7 +986,7 @@ since <productname>PostgreSQL</productname> 7.1.
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.6</title>
 
    <para>
@@ -992,9 +994,9 @@ since <productname>PostgreSQL</productname> 7.1.
     running 7.3.*.
    </para>
 
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -1033,10 +1035,10 @@ in multibyte cases (Korea PostgreSQL Users' Group)</para></listitem>
 operations on bytea columns (Joe)</para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-3-5">
+ <section id="release-7-3-5">
   <title>Release 7.3.5</title>
 
   <formalpara>
@@ -1049,16 +1051,16 @@ operations on bytea columns (Joe)</para></listitem>
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.5</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those
     running 7.3.*.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -1084,10 +1086,10 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Fix corner case for btree search in parallel with first root page split</para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-3-4">
+ <section id="release-7-3-4">
   <title>Release 7.3.4</title>
 
   <formalpara>
@@ -1100,16 +1102,16 @@ operations on bytea columns (Joe)</para></listitem>
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.3.4</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those
     running 7.3.*.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -1123,11 +1125,11 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Work around buggy strxfrm() present in some Solaris releases (Tom)</para></listitem>
 <listitem><para>Properly escape jdbc setObject() strings to improve security (Barry)</para></listitem>
 </itemizedlist>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
 
-<sect1 id="release-7-3-3">
+<section id="release-7-3-3">
  <title>Release 7.3.3</title>
 
  <formalpara>
@@ -1139,16 +1141,16 @@ operations on bytea columns (Joe)</para></listitem>
   This release contains a variety of fixes for version 7.3.2.
  </para>
 
- <sect2>
+ <section>
   <title>Migration to Version 7.3.3</title>
 
   <para>
    A dump/restore is <emphasis>not</emphasis> required for those
    running version 7.3.*.
   </para>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
 <itemizedlist>
@@ -1233,11 +1235,11 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Fixed problem with parsing table ACLs in JDBC</para></listitem>
 <listitem><para>Better error message for character set conversion problems in JDBC</para></listitem>
 </itemizedlist>
- </sect2>
-</sect1>
+ </section>
+</section>
 
 
-<sect1 id="release-7-3-2">
+<section id="release-7-3-2">
  <title>Release 7.3.2</title>
 
  <formalpara>
@@ -1250,16 +1252,16 @@ operations on bytea columns (Joe)</para></listitem>
  </para>
 
 
- <sect2>
+ <section>
   <title>Migration to Version 7.3.2</title>
 
   <para>
    A dump/restore is <emphasis>not</emphasis> required for those
    running version 7.3.*.
   </para>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
 <itemizedlist>
@@ -1294,11 +1296,11 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Add casts between types lo and oid in contrib/lo</para></listitem>
 <listitem><para>fastpath code now checks for privilege to call function</para></listitem>
 </itemizedlist>
- </sect2>
-</sect1>
+ </section>
+</section>
 
 
-<sect1 id="release-7-3-1">
+<section id="release-7-3-1">
  <title>Release 7.3.1</title>
 
  <formalpara>
@@ -1311,7 +1313,7 @@ operations on bytea columns (Joe)</para></listitem>
  </para>
 
 
- <sect2>
+ <section>
   <title>Migration to Version 7.3.1</title>
 
   <para>
@@ -1321,9 +1323,9 @@ operations on bytea columns (Joe)</para></listitem>
    has a new major version number for this release, which might require
    recompilation of client code in certain cases.
   </para>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
 <itemizedlist>
@@ -1344,11 +1346,11 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>SSL fixes (Nathan Mueller)</para></listitem>
 <listitem><para>Prevent composite column creation via ALTER TABLE (Tom)</para></listitem>
 </itemizedlist>
- </sect2>
-</sect1>
+ </section>
+</section>
 
 
-<sect1 id="release-7-3">
+<section id="release-7-3">
  <title>Release 7.3</title>
 
  <formalpara>
@@ -1356,7 +1358,7 @@ operations on bytea columns (Joe)</para></listitem>
   <para>2002-11-27</para>
  </formalpara>
 
- <sect2>
+ <section>
   <title>Overview</title>
 
   <para>
@@ -1478,9 +1480,9 @@ operations on bytea columns (Joe)</para></listitem>
    </varlistentry>
 
   </variablelist>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Migration to Version 7.3</title>
 
   <para>
@@ -1586,12 +1588,12 @@ operations on bytea columns (Joe)</para></listitem>
    </listitem>
 
   </itemizedlist>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
-  <sect3>
+  <section>
    <title>Server Operation</title>
 <itemizedlist>
 <listitem><para>Add pg_locks view to show locks (Neil)</para></listitem>
@@ -1599,9 +1601,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Remove support for version 0 FE/BE protocol (<productname>PostgreSQL</productname> 6.2 and earlier) (Tom)</para></listitem>
 <listitem><para>Reserve the last few backend slots for superusers, add parameter superuser_reserved_connections to control this (Nigel J. Andrews)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Performance</title>
 <itemizedlist>
 <listitem><para>Improve startup by calling localtime() only once (Tom)</para></listitem>
@@ -1623,9 +1625,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Improve free space map performance on large tables (Stephen Marshall, Tom)</para></listitem>
 <listitem><para>Improved WAL write concurrency (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Privileges</title>
 <itemizedlist>
 <listitem><para>Add privileges on functions and procedural languages (Peter)</para></listitem>
@@ -1634,9 +1636,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Add SET SESSION AUTHORIZATION DEFAULT and RESET SESSION AUTHORIZATION (Tom)</para></listitem>
 <listitem><para>Allow functions to be executed with the privilege of the function owner (Peter)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Server Configuration</title>
 <itemizedlist>
 <listitem><para>Server log messages now tagged with LOG, not DEBUG (Bruce)</para></listitem>
@@ -1656,9 +1658,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Rename show_query_stats to show_statement_stats (Bruce)</para></listitem>
 <listitem><para>Add param log_min_error_statement to print commands to logs on error (Gavin)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Queries</title>
 <itemizedlist>
 <listitem><para>Make cursors insensitive, meaning their contents do not change (Tom)</para></listitem>
@@ -1680,9 +1682,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Allow FOR UPDATE to appear after LIMIT/OFFSET (Bruce)</para></listitem>
 <listitem><para>Add variable autocommit (Tom, David Van Wie)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Object Manipulation</title>
 <itemizedlist>
 <listitem><para>Make equals signs optional in CREATE DATABASE (Gavin Sherry)</para></listitem>
@@ -1717,9 +1719,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Add /contrib/adddepend to handle pre-7.3 object dependencies (Rod)</para></listitem>
 <listitem><para>Allow better casting when inserting/updating values (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Utility Commands</title>
 <itemizedlist>
 <listitem><para>Have COPY TO output embedded carriage returns and newlines as \r and \n (Tom)</para></listitem>
@@ -1757,9 +1759,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Fix rare index corruption when a page split affects bulk delete (Tom)</para></listitem>
 <listitem><para>Fix ALTER TABLE ... ADD COLUMN for inheritance (Alvaro Herrera)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Data Types and Functions</title>
 <itemizedlist>
 <listitem><para>Fix factorial(0) to return 1 (Bruce)</para></listitem>
@@ -1803,9 +1805,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Fix to_char(1,'FM999.99') to return a period (Karel)</para></listitem>
 <listitem><para>Fix trigger/type/language functions returning OPAQUE to return proper type (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Internationalization</title>
 <itemizedlist>
 <listitem><para>Add additional encodings: Korean (JOHAB), Thai (WIN874), Vietnamese (TCVN), Arabic (WIN1256), Simplified Chinese (GBK), Korean (UHC) (Eiji Tokuya)</para></listitem>
@@ -1821,9 +1823,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>pg_dumpall, pg_controldata, and pg_resetxlog now national-language aware (Peter)</para></listitem>
 <listitem><para>New and updated translations</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Server-side Languages</title>
 <itemizedlist>
 <listitem><para>Allow recursive SQL function (Peter)</para></listitem>
@@ -1834,9 +1836,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Make PL/pgSQL schema-aware (Joe)</para></listitem>
 <listitem><para>Remove some memory leaks (Nigel J. Andrews, Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>psql</title>
 <itemizedlist>
 <listitem><para>Don't lowercase psql \connect database name for 7.2.0 compatibility (Tom)</para></listitem>
@@ -1851,9 +1853,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Have psql reports its version number on startup (Tom)</para></listitem>
 <listitem><para>Allow \copy to specify column names (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>libpq</title>
 <itemizedlist>
 <listitem><para>Add ~/.pgpass to store host/user password combinations (Alvaro Herrera)</para></listitem>
@@ -1865,9 +1867,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Fix for SSL with non-blocking connections (Jack Bates)</para></listitem>
 <listitem><para>Add libpq connection timeout parameter (Denis A Ustimenko)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>JDBC</title>
 <itemizedlist>
 <listitem><para>Allow JDBC to compile with JDK 1.4 (Dave)</para></listitem>
@@ -1881,9 +1883,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Fix MD5 encryption handling for multibyte servers (Jun Kawai)</para></listitem>
 <listitem><para>Add support for prepared statements (Barry)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Miscellaneous Interfaces</title>
 <itemizedlist>
 <listitem><para>Fixed ECPG bug concerning octal numbers in single quotes (Michael)</para></listitem>
@@ -1897,9 +1899,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Remove src/bin/pgaccess from main tree, now at http://www.pgaccess.org (Bruce)</para></listitem>
 <listitem><para>Add pg_on_connection_loss command to libpgtcl (Gerhard Hintermayer, Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Source Code</title>
 <itemizedlist>
 <listitem><para>Fix for parallel make (Peter)</para></listitem>
@@ -1952,9 +1954,9 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Remove parameter wal_files because WAL files are now recycled (Bruce)</para></listitem>
 <listitem><para>Add version numbers to heap pages (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Contrib</title>
 <itemizedlist>
 <listitem><para>Allow inet arrays in /contrib/array (Neil)</para></listitem>
@@ -1979,12 +1981,12 @@ operations on bytea columns (Joe)</para></listitem>
 <listitem><para>Fixes to /contrib/cube (Bruno Wolff)</para></listitem>
 <listitem><para>Improve /contrib/fulltextindex (Christopher)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-2-8">
+ <section id="release-7-2-8">
   <title>Release 7.2.8</title>
 
   <formalpara>
@@ -1997,15 +1999,15 @@ operations on bytea columns (Joe)</para></listitem>
    security-related issue.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.2.8</title>
 
    <para>
     A dump/restore is not required for those running 7.2.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2032,10 +2034,10 @@ month-related formats</para></listitem>
 (Marko Kreen)</para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-2-7">
+ <section id="release-7-2-7">
   <title>Release 7.2.7</title>
 
   <formalpara>
@@ -2048,15 +2050,15 @@ month-related formats</para></listitem>
    security-related issues.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.2.7</title>
 
    <para>
     A dump/restore is not required for those running 7.2.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2080,10 +2082,10 @@ in case of nested merge joins could give outright wrong answers.
 datestyles</para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-2-6">
+ <section id="release-7-2-6">
   <title>Release 7.2.6</title>
 
   <formalpara>
@@ -2096,15 +2098,15 @@ datestyles</para></listitem>
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.2.6</title>
 
    <para>
     A dump/restore is not required for those running 7.2.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2131,10 +2133,10 @@ concern since there is no reason for non-developers to use this script anyway.
 <listitem><para>Update to newer versions of Bison</para></listitem>
 </itemizedlist>
 
- </sect2>
-</sect1>
+ </section>
+</section>
 
- <sect1 id="release-7-2-5">
+ <section id="release-7-2-5">
   <title>Release 7.2.5</title>
 
   <formalpara>
@@ -2147,15 +2149,15 @@ concern since there is no reason for non-developers to use this script anyway.
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.2.5</title>
 
    <para>
     A dump/restore is not required for those running 7.2.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
 <itemizedlist>
@@ -2174,10 +2176,10 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Repair memory leaks in pg_dump</para></listitem>
 <listitem><para>Avoid conflict with system definition of <function>isblank()</function> function or macro</para></listitem>
 </itemizedlist>
- </sect2>
-</sect1>
+ </section>
+</section>
 
-<sect1 id="release-7-2-4">
+<section id="release-7-2-4">
  <title>Release 7.2.4</title>
 
  <formalpara>
@@ -2190,16 +2192,16 @@ since <productname>PostgreSQL</productname> 7.1.
   including fixes to prevent possible data loss.
  </para>
 
- <sect2>
+ <section>
   <title>Migration to Version 7.2.4</title>
 
   <para>
    A dump/restore is <emphasis>not</emphasis> required for those
    running version 7.2.*.
   </para>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
 <itemizedlist>
@@ -2212,11 +2214,11 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Fix integer overflows in circle_poly(), path_encode(), path_add()  (Neil)</para></listitem>
 <listitem><para>Repair long-standing logic errors in lseg_eq(), lseg_ne(), lseg_center()</para></listitem>
 </itemizedlist>
- </sect2>
-</sect1>
+ </section>
+</section>
 
 
-<sect1 id="release-7-2-3">
+<section id="release-7-2-3">
  <title>Release 7.2.3</title>
 
  <formalpara>
@@ -2229,16 +2231,16 @@ since <productname>PostgreSQL</productname> 7.1.
   including fixes to prevent possible data loss.
  </para>
 
- <sect2>
+ <section>
   <title>Migration to Version 7.2.3</title>
 
   <para>
    A dump/restore is <emphasis>not</emphasis> required for those
    running version 7.2.*.
   </para>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
 <itemizedlist>
@@ -2249,11 +2251,11 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Prevent spinlock hangs on SMP PPC machines (Tomoyuki Niijima)</para></listitem>
 <listitem><para>Fix <application>pg_dump</application> to properly dump FULL JOIN USING (Tom)</para></listitem>
 </itemizedlist>
- </sect2>
-</sect1>
+ </section>
+</section>
 
 
-<sect1 id="release-7-2-2">
+<section id="release-7-2-2">
  <title>Release 7.2.2</title>
 
  <formalpara>
@@ -2265,16 +2267,16 @@ since <productname>PostgreSQL</productname> 7.1.
   This release contains a variety of fixes for version 7.2.1.
  </para>
 
- <sect2>
+ <section>
   <title>Migration to Version 7.2.2</title>
 
   <para>
    A dump/restore is <emphasis>not</emphasis> required for those
    running version 7.2.*.
   </para>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
 <itemizedlist>
@@ -2292,11 +2294,11 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Fix for crash with long DATA strings (Thomas, Neil)</para></listitem>
 <listitem><para>Fix for repeat(), lpad(), rpad() and long strings (Neil)</para></listitem>
 </itemizedlist>
- </sect2>
-</sect1>
+ </section>
+</section>
 
 
-<sect1 id="release-7-2-1">
+<section id="release-7-2-1">
  <title>Release 7.2.1</title>
 
  <formalpara>
@@ -2308,16 +2310,16 @@ since <productname>PostgreSQL</productname> 7.1.
   This release contains a variety of fixes for version 7.2.
  </para>
 
- <sect2>
+ <section>
   <title>Migration to Version 7.2.1</title>
 
   <para>
    A dump/restore is <emphasis>not</emphasis> required for those
    running version 7.2.
   </para>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
 <itemizedlist>
@@ -2338,11 +2340,11 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Fix for array subscripts handling (Tom)</para></listitem>
 <listitem><para>Allow EXECUTE of "CREATE TABLE AS ... SELECT" in PL/pgSQL (Tom)</para></listitem>
 </itemizedlist>
- </sect2>
-</sect1>
+ </section>
+</section>
 
 
-<sect1 id="release-7-2">
+<section id="release-7-2">
  <title>Release 7.2</title>
 
  <formalpara>
@@ -2350,7 +2352,7 @@ since <productname>PostgreSQL</productname> 7.1.
   <para>2002-02-04</para>
  </formalpara>
 
- <sect2>
+ <section>
   <title>Overview</title>
 
   <para>
@@ -2437,9 +2439,9 @@ since <productname>PostgreSQL</productname> 7.1.
    </varlistentry>
 
   </variablelist>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Migration to Version 7.2</title>
 
   <para>
@@ -2508,12 +2510,12 @@ since <productname>PostgreSQL</productname> 7.1.
    separate LIMIT and OFFSET clauses, e.g. <literal>LIMIT 10 OFFSET
    20</literal>.
   </para>
- </sect2>
+ </section>
 
- <sect2>
+ <section>
   <title>Changes</title>
 
-  <sect3>
+  <section>
    <title>Server Operation</title>
 <itemizedlist>
 <listitem><para>Create temporary files in a separate directory (Bruce)</para></listitem>
@@ -2537,9 +2539,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Superuser ID now fixed at 1 (Peter E)</para></listitem>
 <listitem><para>New pg_ctl "reload" option (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Performance</title>
 <itemizedlist>
 <listitem><para>Optimizer improvements (Tom)</para></listitem>
@@ -2553,9 +2555,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>R-tree performance improvements (Kenneth Been)</para></listitem>
 <listitem><para>B-tree splits more efficient (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Privileges</title>
 <itemizedlist>
 <listitem><para>Change UPDATE, DELETE privileges to be distinct (Peter E)</para></listitem>
@@ -2567,9 +2569,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Fix bug in privilege modifications on newly created tables (Tom)</para></listitem>
 <listitem><para>Disallow access to pg_statistic for non-superuser, add user-accessible views (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Client Authentication</title>
 <itemizedlist>
 <listitem><para>Fork postmaster before doing authentication to prevent hangs (Peter E)</para></listitem>
@@ -2579,9 +2581,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>PAM authentication (Dominic J. Eidson)</para></listitem>
 <listitem><para>Load pg_hba.conf and pg_ident.conf only on startup and SIGHUP (Bruce)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Server Configuration</title>
 <itemizedlist>
 <listitem><para>Interpretation of some time zone abbreviations as Australian rather than North American now settable at run time (Bruce)</para></listitem>
@@ -2591,9 +2593,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>New parameter to set client authentication timeout (Tom)</para></listitem>
 <listitem><para>New parameter to set maximum number of open files (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Queries</title>
 <itemizedlist>
 <listitem><para>Statements added by INSERT rules now execute after the INSERT (Jan)</para></listitem>
@@ -2606,9 +2608,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Fix for LIMIT, DISTINCT ON pushed into subqueries (Tom)</para></listitem>
 <listitem><para>Fix nested EXCEPT/INTERSECT (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Schema Manipulation</title>
 <itemizedlist>
 <listitem><para>Fix SERIAL in temporary tables (Bruce)</para></listitem>
@@ -2629,9 +2631,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Allow GiST indexes to handle NULLs and multikey indexes (Oleg Bartunov, Teodor Sigaev, Tom)</para></listitem>
 <listitem><para>Enable partial indexes (Martijn van Oosterhout)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Utility Commands</title>
 <itemizedlist>
 <listitem><para>Add RESET ALL, SHOW ALL (Marko Kreen)</para></listitem>
@@ -2645,9 +2647,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Fix privilege checks for CREATE INDEX (Tom)</para></listitem>
 <listitem><para>Disallow inappropriate use of CREATE/DROP INDEX/TRIGGER/VIEW (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Data Types and Functions</title>
 <itemizedlist>
 <listitem><para>SUM(), AVG(), COUNT() now uses int8 internally for speed (Tom)</para></listitem>
@@ -2688,9 +2690,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Some datatype() function calls now evaluated differently</para></listitem>
 <listitem><para>Add support for Julian and ISO time specifications (Thomas)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Internationalization</title>
 <itemizedlist>
 <listitem><para>National language support in psql, <application>pg_dump</application>, libpq, and server (Peter E)</para></listitem>
@@ -2702,9 +2704,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Make mic2ascii() non-ASCII aware (Tatsuo)</para></listitem>
 <listitem><para>Reject invalid multibyte character sequences (Tatsuo)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title><application>PL/pgSQL</application></title>
 <itemizedlist>
 <listitem><para>Now uses portals for SELECT loops, allowing huge result sets (Jan)</para></listitem>
@@ -2719,32 +2721,32 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Memory leak fix (Jan, Tom)</para></listitem>
 <listitem><para>Make trailing semicolon optional (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>PL/Perl</title>
 <itemizedlist>
 <listitem><para>New untrusted PL/Perl (Alex Pilosov)</para></listitem>
 <listitem><para>PL/Perl is now built on some platforms even if libperl is not shared (Peter E)</para></listitem>
 </itemizedlist>
-   </sect3>
+   </section>
 
-  <sect3>
+  <section>
    <title>PL/Tcl</title>
 <itemizedlist>
 <listitem><para>Now reports errorInfo (Vsevolod Lobko)</para></listitem>
 <listitem><para>Add spi_lastoid function (bob@redivi.com)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>PL/Python</title>
 <itemizedlist>
 <listitem><para>...is new (Andrew Bosma)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title><application>psql</application></title>
 <itemizedlist>
 <listitem><para>\d displays indexes in unique, primary groupings (Christopher Kings-Lynne)</para></listitem>
@@ -2753,17 +2755,17 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Force new password prompt when changing user and database (Tatsuo, Tom)</para></listitem>
 <listitem><para>Format the correct number of columns for Unicode (Patrice)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title><application>libpq</application></title>
 <itemizedlist>
 <listitem><para>New function PQescapeString() to escape quotes in command strings (Florian Weimer)</para></listitem>
 <listitem><para>New function PQescapeBytea() escapes binary strings for use as SQL string literals</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>JDBC</title>
 <itemizedlist>
 <listitem><para>Return OID of INSERT (Ken K)</para></listitem>
@@ -2799,9 +2801,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>MD5 password encryption support (Jeremy Wohl)</para></listitem>
 <listitem><para>Fix to actually use type cache (Ned Wolpert)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>ODBC</title>
 <itemizedlist>
 <listitem><para>Remove query size limit (Hiroshi)</para></listitem>
@@ -2815,9 +2817,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>MD5 password encryption support (Bruce)</para></listitem>
 <listitem><para>Add more compatibility functions to odbc.sql (Peter E)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title><application>ECPG</application></title>
 <itemizedlist>
 <listitem><para>EXECUTE ... INTO implemented (Christof Petig)</para></listitem>
@@ -2831,9 +2833,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>All function names with external linkage are now prefixed by ECPG</para></listitem>
 <listitem><para>Fixes for arrays of structures (Michael)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Misc. Interfaces</title>
 <itemizedlist>
 <listitem><para>Python fix fetchone() (Gerhard Haring)</para></listitem>
@@ -2842,9 +2844,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Prevent output of default index op class in <application>pg_dump</application> (Tom)</para></listitem>
 <listitem><para>Fix libpgeasy memory leak (Bruce)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Build and Install</title>
 <itemizedlist>
 <listitem><para>Configure, dynamic loader, and shared library fixes (Peter E)</para></listitem>
@@ -2860,9 +2862,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Rename config.h to pg_config.h (Peter E)</para></listitem>
 <listitem><para>Reorganize installation layout of header files (Peter E)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Source Code</title>
 <itemizedlist>
 <listitem><para>Remove SEP_CHAR (Bruce)</para></listitem>
@@ -2877,9 +2879,9 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>Add 'volatile' usage in spinlock structures</para></listitem>
 <listitem><para>Improve signal handling logic (Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
+  </section>
 
-  <sect3>
+  <section>
    <title>Contrib</title>
 <itemizedlist>
 <listitem><para>New contrib/rtree_gist (Oleg Bartunov, Teodor Sigaev)</para></listitem>
@@ -2893,12 +2895,12 @@ since <productname>PostgreSQL</productname> 7.1.
 <listitem><para>New pg_upgrade utility (Bruce)</para></listitem>
 <listitem><para>Add new pg_resetxlog options (Bruce, Tom)</para></listitem>
 </itemizedlist>
-  </sect3>
- </sect2>
-</sect1>
+  </section>
+ </section>
+</section>
 
 
- <sect1 id="release-7-1-3">
+ <section id="release-7-1-3">
   <title>Release 7.1.3</title>
 
   <formalpara>
@@ -2906,16 +2908,16 @@ since <productname>PostgreSQL</productname> 7.1.
   <para>2001-08-15</para>
   </formalpara>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.1.3</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those running
     7.1.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -2932,11 +2934,11 @@ Disable COPY TO/FROM a view (Tom)
 Cygwin build (Jason Tishler)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
 
- <sect1 id="release-7-1-2">
+ <section id="release-7-1-2">
   <title>Release 7.1.2</title>
 
   <formalpara>
@@ -2949,16 +2951,16 @@ Cygwin build (Jason Tishler)
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.1.2</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those running
     7.1.X.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -2970,11 +2972,11 @@ Optimizer fixes
 pg_dump cleanups
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
 
- <sect1 id="release-7-1-1">
+ <section id="release-7-1-1">
   <title>Release 7.1.1</title>
 
   <formalpara>
@@ -2987,16 +2989,16 @@ pg_dump cleanups
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.1.1</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those running
     7.1.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -3017,11 +3019,11 @@ EXTRACT can now take string argument (Thomas)
 Python fixes (Darcy)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
 
- <sect1 id="release-7-1">
+ <section id="release-7-1">
   <title>Release 7.1</title>
 
   <formalpara>
@@ -3114,16 +3116,16 @@ Subqueries in FROM are now supported.
 
   </variablelist>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.1</title>
 
    <para>
        A dump/restore using pg_dump is required for those wishing to migrate
        data from any previous release.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -3315,11 +3317,11 @@ New contrib/pg_control utility (Oliver)
 New FreeBSD tools ipc_check, start-scripts/freebsd
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
 
- <sect1 id="release-7-0-3">
+ <section id="release-7-0-3">
   <title>Release 7.0.3</title>
 
   <formalpara>
@@ -3332,16 +3334,16 @@ New FreeBSD tools ipc_check, start-scripts/freebsd
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.0.3</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those running
     7.0.*.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -3387,11 +3389,11 @@ Fix for inserting/copying longer multibyte strings into char() data
 Fix for crash of backend, on abort (Tom)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
 
- <sect1 id="release-7-0-2">
+ <section id="release-7-0-2">
   <title>Release 7.0.2</title>
 
   <formalpara>
@@ -3404,16 +3406,16 @@ Fix for crash of backend, on abort (Tom)
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.0.2</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those running
     7.*.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -3421,11 +3423,11 @@ Fix for crash of backend, on abort (Tom)
 Added documentation to tarball.
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
 
- <sect1 id="release-7-0-1">
+ <section id="release-7-0-1">
   <title>Release 7.0.1</title>
 
   <formalpara>
@@ -3437,16 +3439,16 @@ Added documentation to tarball.
    This is a cleanup release for 7.0.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.0.1</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those running
     7.0.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -3477,10 +3479,10 @@ JDBC ResultSet.getTimestamp() fix (Gregory Krasnow &amp; Floyd Marinescu)
 ecpg changes (Michael)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-7-0">
+ <section id="release-7-0">
   <title>Release 7.0</title>
 
   <formalpara>
@@ -3557,7 +3559,7 @@ ecpg changes (Michael)
    </varlistentry>
   </variablelist>
 
-  <sect2>
+  <section>
    <title>Migration to Version 7.0</title>
 
    <para>
@@ -3620,9 +3622,9 @@ ecpg changes (Michael)
      </para>
     </listitem>
    </itemizedlist>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -3946,10 +3948,10 @@ Fixes for Alpha compiles
 New multibyte encodings
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-6-5-3">
+ <section id="release-6-5-3">
   <title>Release 6.5.3</title>
 
   <formalpara>
@@ -3963,15 +3965,15 @@ New multibyte encodings
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 6.5.3</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those running
     6.5.*.
    </para>
-  </sect2>
-  <sect2>
+  </section>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -3981,11 +3983,11 @@ NT-specific patch
 Fix dumping rules on inherited tables
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
 
- <sect1 id="release-6-5-2">
+ <section id="release-6-5-2">
   <title>Release 6.5.2</title>
 
   <formalpara>
@@ -3999,16 +4001,16 @@ Fix dumping rules on inherited tables
   </para>
 
 
-  <sect2>
+  <section>
    <title>Migration to Version 6.5.2</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those running
     6.5.*.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -4039,10 +4041,10 @@ Repair incorrect cleanup of heap memory allocation during transaction abort(Tom)
 Updated version of pgaccess 0.98
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-6-5-1">
+ <section id="release-6-5-1">
   <title>Release 6.5.1</title>
 
   <formalpara>
@@ -4055,16 +4057,16 @@ Updated version of pgaccess 0.98
    problems reported by 6.5 users.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 6.5.1</title>
 
    <para>
     A dump/restore is <emphasis>not</emphasis> required for those running
     6.5.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -4094,10 +4096,10 @@ Fix some compiler warnings (Tomoaki Nishiyama)
 Add Win1250 (Czech) support (Pavel Behal)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-6-5">
+ <section id="release-6-5">
   <title>Release 6.5</title>
 
   <formalpara>
@@ -4254,7 +4256,7 @@ Add Win1250 (Czech) support (Pavel Behal)
    </variablelist>
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 6.5</title>
 
    <para>
@@ -4274,7 +4276,7 @@ Add Win1250 (Czech) support (Pavel Behal)
      behavior you need.</emphasis>
    </para>
 
-   <sect3>
+   <section>
     <title>Multiversion Concurrency Control</title>
 
     <para>
@@ -4322,10 +4324,10 @@ Add Win1250 (Czech) support (Pavel Behal)
      (uncommitted) data (regardless of isolation level) and true referential
      integrity will be implemented.
     </para>
-   </sect3>
-   </sect2>
+   </section>
+   </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -4493,11 +4495,11 @@ Improve file handling to be more uniform, prevent file descriptor leak(Tom)
 New install commands for plpgsql(Jan)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
 
-<sect1 id="release-6-4-2">
+<section id="release-6-4-2">
 <title>Release 6.4.2</title>
 
   <formalpara>
@@ -4511,15 +4513,15 @@ bug fix.
 </para>
 
 
-<sect2>
+<section>
 <title>Migration to Version 6.4.2</title>
 
 <para>
 A dump/restore is <emphasis>not</emphasis> required for those running
 6.4.*.
 </para>
-</sect2>
-<sect2>
+</section>
+<section>
 <title>Changes</title>
 
 <para>
@@ -4527,12 +4529,12 @@ A dump/restore is <emphasis>not</emphasis> required for those running
 Fix for datetime constant problem on some platforms(Thomas)
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
 
 
-<sect1 id="release-6-4-1">
+<section id="release-6-4-1">
 <title>Release 6.4.1</title>
 
   <formalpara>
@@ -4546,15 +4548,15 @@ problems reported by 6.4 users.
 </para>
 
 
-<sect2>
+<section>
 <title>Migration to Version 6.4.1</title>
 
 <para>
 A dump/restore is <emphasis>not</emphasis> required for those running
 6.4.
 </para>
-</sect2>
-<sect2>
+</section>
+<section>
 <title>Changes</title>
 
 <para>
@@ -4591,12 +4593,12 @@ Compilation of libpq for Windows fixes(Magnus)
 Upgrade to PyGreSQL 2.2(D'Arcy)
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
 
 
-<sect1 id="release-6-4">
+<section id="release-6-4">
 <title>Release 6.4</title>
 
   <formalpara>
@@ -4680,7 +4682,7 @@ been.
 </itemizedlist>
 </para>
 
-<sect2>
+<section>
 <title>Migration to Version 6.4</title>
 
 <para>
@@ -4689,9 +4691,9 @@ or <application>pg_dumpall</application>
 is required for those wishing to migrate data from any
 previous release of <productname>PostgreSQL</productname>.
 </para>
-</sect2>
+</section>
 
-  <sect2>
+  <section>
 <title>Changes</title>
 
    <para>
@@ -4890,10 +4892,10 @@ configure uses supplied install-sh if no install script found(Tom)
 new Makefile.shlib for shared library configuration(Tom)
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-6-3-2">
+<section id="release-6-3-2">
 <title>Release 6.3.2</title>
 
   <formalpara>
@@ -4935,7 +4937,7 @@ For upgrades from pre-6.3 installations,
 refer to the installation and migration instructions for version 6.3.
 </para>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -4960,10 +4962,10 @@ Makefile dependency cleanup(Jeroen van Vianen)
 ASSERT fixes(Bruce)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-6-3-1">
+ <section id="release-6-3-1">
   <title>Release 6.3.1</title>
 
   <formalpara>
@@ -5012,7 +5014,7 @@ For upgrades from pre-6.3 installations,
 refer to the installation and migration instructions for version 6.3.
 </para>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -5046,10 +5048,10 @@ Solaris compile fix(Albert Chin-A-Young)
 Better identify tcl and tk libs and includes(Bruce)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
- <sect1 id="release-6-3">
+ <section id="release-6-3">
   <title>Release 6.3</title>
 
   <formalpara>
@@ -5176,7 +5178,7 @@ Better identify tcl and tk libs and includes(Bruce)
    are no longer needed.
   </para>
 
-  <sect2>
+  <section>
    <title>Migration to Version 6.3</title>
 
    <para>
@@ -5185,9 +5187,9 @@ Better identify tcl and tk libs and includes(Bruce)
     is required for those wishing to migrate data from any
     previous release of <productname>PostgreSQL</productname>.
    </para>
-  </sect2>
+  </section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -5358,10 +5360,10 @@ Expand a few function names formerly truncated to 16 characters(Thomas)
 Remove un-needed malloc() calls and replace with palloc()(Bruce)
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-6-2-1">
+<section id="release-6-2-1">
 <title>Release 6.2.1</title>
 
   <formalpara>
@@ -5396,7 +5398,7 @@ For upgrades from pre-6.2 systems, a full dump/reload is required.
 Refer to the 6.2 release notes for instructions.
 </para>
 
-<sect2>
+<section>
 <title>Migration from version 6.2 to version 6.2.1</title>
 
 <para>
@@ -5420,9 +5422,9 @@ update pg_aggregate set aggfinalfn = 'cash_div_flt8'
 <para>
 This will need to be done to every existing database, including template1.
 </para>
-</sect2>
+</section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -5440,10 +5442,10 @@ Documented new libpq function to return affected rows, PQcmdTuples(Bruce)
 Trigger function for inserting user names for INSERT/UPDATE(Brook Milligan)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
-<sect1 id="release-6-2">
+<section id="release-6-2">
 <title>Release 6.2</title>
 
   <formalpara>
@@ -5456,7 +5458,7 @@ A dump/restore is required for those wishing to migrate data from
 previous releases of <productname>PostgreSQL</productname>.
 </para>
 
-<sect2>
+<section>
 <title>Migration from version 6.1 to version 6.2</title>
 
 <para>
@@ -5467,18 +5469,18 @@ restore of the database in 6.2.
 Note that the <command>pg_dump</command> and <command>pg_dumpall</command> utility from 6.2 should be used
 to dump the 6.1 database.
 </para>
-</sect2>
+</section>
 
-<sect2>
+<section>
 <title>Migration from version 1.<replaceable>x</replaceable> to version 6.2</title>
 
 <para>
 Those migrating from earlier 1.* releases should first upgrade to 1.09
 because the COPY output format was improved from the 1.02 release.
 </para>
-</sect2>
+</section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -5593,10 +5595,10 @@ Files moved to /src/tools directory(Bruce)
 SPI and Trigger programming guides (Vadim &amp; D'Arcy)
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-6-1-1">
+<section id="release-6-1-1">
 <title>Release 6.1.1</title>
 
   <formalpara>
@@ -5604,7 +5606,7 @@ SPI and Trigger programming guides (Vadim &amp; D'Arcy)
   <para>1997-07-22</para>
   </formalpara>
 
-<sect2>
+<section>
 <title>Migration from version 6.1 to version 6.1.1</title>
 
 <para>
@@ -5612,9 +5614,9 @@ This is a minor bug-fix release. A dump/reload is not required from version 6.1,
 but is required from any release prior to 6.1.
 Refer to the release notes for 6.1 for more details.
 </para>
-</sect2>
+</section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -5638,10 +5640,10 @@ allow underscores in usernames(Bruce)
 pg_dumpall now returns proper status, portability fix(Bruce)
 </programlisting>
    </para>
-  </sect2>
- </sect1>
+  </section>
+ </section>
 
-<sect1 id="release-6-1">
+<section id="release-6-1">
 <title>Release 6.1</title>
 
   <formalpara>
@@ -5696,7 +5698,7 @@ optimizer which uses <firstterm>genetic</firstterm>
  machine (Linux/<application>gcc</application>/i686).
 </para>
 
-<sect2>
+<section>
 <title>Migration to Version 6.1</title>
 
 <para>
@@ -5707,9 +5709,9 @@ restore of the database in 6.1.
 Those migrating from earlier 1.* releases should first upgrade to 1.09
 because the COPY output format was improved from the 1.02 release.
 </para>
-</sect2>
+</section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -5810,10 +5812,10 @@ warn about buggy flex(Bruce)
 DG/UX, Ultrix, IRIX, AIX portability fixes
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-6-0">
+<section id="release-6-0">
 <title>Release 6.0</title>
 
   <formalpara>
@@ -5826,25 +5828,25 @@ A dump/restore is required for those wishing to migrate data from
 previous releases of <productname>PostgreSQL</productname>.
 </para>
 
-<sect2>
+<section>
 <title>Migration from version 1.09 to version 6.0</title>
 
 <para>
 This migration requires a complete dump of the 1.09 database and a
 restore of the database in 6.0.
 </para>
-</sect2>
+</section>
 
-<sect2>
+<section>
 <title>Migration from pre-1.09 to version 6.0</title>
 
 <para>
 Those migrating from earlier 1.* releases should first upgrade to 1.09
 because the COPY output format was improved from the 1.02 release.
 </para>
-</sect2>
+</section>
 
-  <sect2>
+  <section>
    <title>Changes</title>
 
    <para>
@@ -5954,10 +5956,10 @@ Restructured port-specific file locations(Bryan, Marc)
 Unused/uninitialized variables corrected
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-1-09">
+<section id="release-1-09">
 <title>Release 1.09</title>
 
   <formalpara>
@@ -5970,9 +5972,9 @@ Sorry, we didn't keep track of changes from 1.02 to 1.09.  Some of
 the changes listed in 6.0 were actually included in the 1.02.1 to 1.09
 releases.
 </para>
-</sect1>
+</section>
 
-<sect1 id="release-1-02">
+<section id="release-1-02">
 <title>Release 1.02</title>
 
   <formalpara>
@@ -5980,7 +5982,7 @@ releases.
   <para>1996-08-01</para>
   </formalpara>
 
-<sect2>
+<section>
 <title>Migration from version 1.02 to version 1.02.1</title>
 
 <para>
@@ -6026,9 +6028,9 @@ not a cause for concern.
 </para>
 </step>
 </procedure>
-</sect2>
+</section>
 
-<sect2>
+<section>
 <title>Dump/Reload Procedure</title>
 
 <para>
@@ -6056,9 +6058,9 @@ create operator ~* (leftarg = varchar, rightarg = text, procedure = texticregexe
 create operator !~* (leftarg = varchar, rightarg = text, procedure = texticregexne);
 </programlisting>
 </para>
-</sect2>
+</section>
 
-<sect2>
+<section>
 <title>Changes</title>
 
 <para>
@@ -6118,10 +6120,10 @@ Contributors (apologies to any missed)
  * Paul "Shag" Walmsley &lt;ccshag@cclabs.missouri.edu&gt;
  * "Alistair G. Crooks" &lt;azcb0@sde.uts.amdahl.com&gt;
 -->
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-1-01">
+<section id="release-1-01">
 <title>Release 1.01</title>
 
    <formalpara>
@@ -6130,7 +6132,7 @@ Contributors (apologies to any missed)
    </formalpara>
 
 
-<sect2>
+<section>
 <title>Migration from version 1.0 to version 1.01</title>
 
 <para>
@@ -6269,9 +6271,9 @@ create operator !~* (leftarg = text, rightarg = text, procedure = texticregexne)
 </para>
 </step>
 </procedure>
-</sect2>
+</section>
 
-<sect2>
+<section>
 <title>Changes</title>
 
 <para>
@@ -6310,10 +6312,10 @@ Bug fixes:
  * applied public patches 1-14
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-1-0">
+<section id="release-1-0">
 <title>Release 1.0</title>
 
    <formalpara>
@@ -6321,7 +6323,7 @@ Bug fixes:
    <para>1995-09-05</para>
    </formalpara>
 
-<sect2>
+<section>
 <title>Changes</title>
 
 <para>
@@ -6367,10 +6369,10 @@ Bug fixes:
    work when you try to use them
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-0-03">
+<section id="release-0-03">
 <title><productname>Postgres95</productname> Release 0.03</title>
 
    <formalpara>
@@ -6378,7 +6380,7 @@ Bug fixes:
    <para>1995-07-21</para>
    </formalpara>
 
-<sect2>
+<section>
 <title>Changes</title>
 <para>
 <programlisting>
@@ -6489,10 +6491,10 @@ New documentation:
  * the user manual has been revised and libpq documentation added.
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-0-02">
+<section id="release-0-02">
 <title><productname>Postgres95</productname> Release 0.02</title>
 
    <formalpara>
@@ -6500,7 +6502,7 @@ New documentation:
    <para>1995-05-25</para>
    </formalpara>
 
-<sect2>
+<section>
 <title>Changes</title>
 
 <para>
@@ -6540,10 +6542,10 @@ The following bugs have been fixed in postgres95-beta-0.02:
  * wrong result using more than 1 aggregate in a SELECT
 </programlisting>
 </para>
-</sect2>
-</sect1>
+</section>
+</section>
 
-<sect1 id="release-0-01">
+<section id="release-0-01">
 <title><productname>Postgres95</productname> Release 0.01</title>
 
    <formalpara>
@@ -6554,4 +6556,5 @@ The following bugs have been fixed in postgres95-beta-0.02:
 <para>
 Initial release.
 </para>
-</sect1>
+</section>
+</section>
diff --git a/doc/src/sgml/xfunc-sql.sgml b/doc/src/sgml/xfunc-sql.sgml
new file mode 100644
index 0000000000..c0539f17cd
--- /dev/null
+++ b/doc/src/sgml/xfunc-sql.sgml
@@ -0,0 +1,1291 @@
+<!-- doc/src/sgml/xfunc-sql.sgml -->
+
+  <sect1 id="xfunc-sql">
+   <title>Query Language (<acronym>SQL</acronym>) Functions</title>
+
+   <indexterm zone="xfunc-sql">
+    <primary>function</primary>
+    <secondary>user-defined</secondary>
+    <tertiary>in SQL</tertiary>
+   </indexterm>
+
+   <para>
+    SQL functions execute an arbitrary list of SQL statements, returning
+    the result of the last query in the list.
+    In the simple (non-set)
+    case, the first row of the last query's result will be returned.
+    (Bear in mind that <quote>the first row</quote> of a multirow
+    result is not well-defined unless you use <literal>ORDER BY</literal>.)
+    If the last query happens
+    to return no rows at all, the null value will be returned.
+   </para>
+
+   <para>
+    Alternatively, an SQL function can be declared to return a set (that is,
+    multiple rows) by specifying the function's return type as <literal>SETOF
+    <replaceable>sometype</replaceable></literal>, or equivalently by declaring it as
+    <literal>RETURNS TABLE(<replaceable>columns</replaceable>)</literal>.  In this case
+    all rows of the last query's result are returned.  Further details appear
+    below.
+   </para>
+
+   <para>
+    The body of an SQL function must be a list of SQL
+    statements separated by semicolons.  A semicolon after the last
+    statement is optional.  Unless the function is declared to return
+    <type>void</type>, the last statement must be a <command>SELECT</command>,
+    or an <command>INSERT</command>, <command>UPDATE</command>, or <command>DELETE</command>
+    that has a <literal>RETURNING</literal> clause.
+   </para>
+
+    <para>
+     Any collection of commands in the  <acronym>SQL</acronym>
+     language can be packaged together and defined as a function.
+     Besides <command>SELECT</command> queries, the commands can include data
+     modification queries (<command>INSERT</command>,
+     <command>UPDATE</command>, and <command>DELETE</command>), as well as
+     other SQL commands. (You cannot use transaction control commands, e.g.
+     <command>COMMIT</command>, <command>SAVEPOINT</command>, and some utility
+     commands, e.g.  <literal>VACUUM</literal>, in <acronym>SQL</acronym> functions.)
+     However, the final command
+     must be a <command>SELECT</command> or have a <literal>RETURNING</literal>
+     clause that returns whatever is
+     specified as the function's return type.  Alternatively, if you
+     want to define a SQL function that performs actions but has no
+     useful value to return, you can define it as returning <type>void</type>.
+     For example, this function removes rows with negative salaries from
+     the <literal>emp</literal> table:
+
+<screen>
+CREATE FUNCTION clean_emp() RETURNS void AS '
+    DELETE FROM emp
+        WHERE salary &lt; 0;
+' LANGUAGE SQL;
+
+SELECT clean_emp();
+
+ clean_emp
+-----------
+
+(1 row)
+</screen>
+    </para>
+
+    <note>
+     <para>
+      The entire body of a SQL function is parsed before any of it is
+      executed.  While a SQL function can contain commands that alter
+      the system catalogs (e.g., <command>CREATE TABLE</command>), the effects
+      of such commands will not be visible during parse analysis of
+      later commands in the function.  Thus, for example,
+      <literal>CREATE TABLE foo (...); INSERT INTO foo VALUES(...);</literal>
+      will not work as desired if packaged up into a single SQL function,
+      since <structname>foo</structname> won't exist yet when the <command>INSERT</command>
+      command is parsed.  It's recommended to use <application>PL/pgSQL</application>
+      instead of a SQL function in this type of situation.
+     </para>
+   </note>
+
+   <para>
+    The syntax of the <command>CREATE FUNCTION</command> command requires
+    the function body to be written as a string constant.  It is usually
+    most convenient to use dollar quoting (see <xref
+    linkend="sql-syntax-dollar-quoting"/>) for the string constant.
+    If you choose to use regular single-quoted string constant syntax,
+    you must double single quote marks (<literal>'</literal>) and backslashes
+    (<literal>\</literal>) (assuming escape string syntax) in the body of
+    the function (see <xref linkend="sql-syntax-strings"/>).
+   </para>
+
+   <sect2 id="xfunc-sql-function-arguments">
+    <title>Arguments for <acronym>SQL</acronym> Functions</title>
+
+   <indexterm>
+    <primary>function</primary>
+    <secondary>named argument</secondary>
+   </indexterm>
+
+    <para>
+     Arguments of a SQL function can be referenced in the function
+     body using either names or numbers.  Examples of both methods appear
+     below.
+    </para>
+
+    <para>
+     To use a name, declare the function argument as having a name, and
+     then just write that name in the function body.  If the argument name
+     is the same as any column name in the current SQL command within the
+     function, the column name will take precedence.  To override this,
+     qualify the argument name with the name of the function itself, that is
+     <literal><replaceable>function_name</replaceable>.<replaceable>argument_name</replaceable></literal>.
+     (If this would conflict with a qualified column name, again the column
+     name wins.  You can avoid the ambiguity by choosing a different alias for
+     the table within the SQL command.)
+    </para>
+
+    <para>
+     In the older numeric approach, arguments are referenced using the syntax
+     <literal>$<replaceable>n</replaceable></literal>: <literal>$1</literal> refers to the first input
+     argument, <literal>$2</literal> to the second, and so on.  This will work
+     whether or not the particular argument was declared with a name.
+    </para>
+
+    <para>
+     If an argument is of a composite type, then the dot notation,
+     e.g., <literal><replaceable>argname</replaceable>.<replaceable>fieldname</replaceable></literal> or
+     <literal>$1.<replaceable>fieldname</replaceable></literal>, can be used to access attributes of the
+     argument.  Again, you might need to qualify the argument's name with the
+     function name to make the form with an argument name unambiguous.
+    </para>
+
+    <para>
+     SQL function arguments can only be used as data values,
+     not as identifiers.  Thus for example this is reasonable:
+<programlisting>
+INSERT INTO mytable VALUES ($1);
+</programlisting>
+but this will not work:
+<programlisting>
+INSERT INTO $1 VALUES (42);
+</programlisting>
+    </para>
+
+    <note>
+     <para>
+      The ability to use names to reference SQL function arguments was added
+      in <productname>PostgreSQL</productname> 9.2.  Functions to be used in
+      older servers must use the <literal>$<replaceable>n</replaceable></literal> notation.
+     </para>
+    </note>
+   </sect2>
+
+   <sect2 id="xfunc-sql-base-functions">
+    <title><acronym>SQL</acronym> Functions on Base Types</title>
+
+    <para>
+     The simplest possible <acronym>SQL</acronym> function has no arguments and
+     simply returns a base type, such as <type>integer</type>:
+
+<screen>
+CREATE FUNCTION one() RETURNS integer AS $$
+    SELECT 1 AS result;
+$$ LANGUAGE SQL;
+
+-- Alternative syntax for string literal:
+CREATE FUNCTION one() RETURNS integer AS '
+    SELECT 1 AS result;
+' LANGUAGE SQL;
+
+SELECT one();
+
+ one
+-----
+   1
+</screen>
+    </para>
+
+    <para>
+     Notice that we defined a column alias within the function body for the result of the function
+     (with  the  name <literal>result</literal>),  but this column alias is not visible
+     outside the function.  Hence,  the  result  is labeled <literal>one</literal>
+     instead of <literal>result</literal>.
+    </para>
+
+    <para>
+     It is almost as easy to define <acronym>SQL</acronym> functions
+     that take base types as arguments:
+
+<screen>
+CREATE FUNCTION add_em(x integer, y integer) RETURNS integer AS $$
+    SELECT x + y;
+$$ LANGUAGE SQL;
+
+SELECT add_em(1, 2) AS answer;
+
+ answer
+--------
+      3
+</screen>
+    </para>
+
+    <para>
+     Alternatively, we could dispense with names for the arguments and
+     use numbers:
+
+<screen>
+CREATE FUNCTION add_em(integer, integer) RETURNS integer AS $$
+    SELECT $1 + $2;
+$$ LANGUAGE SQL;
+
+SELECT add_em(1, 2) AS answer;
+
+ answer
+--------
+      3
+</screen>
+    </para>
+
+    <para>
+     Here is a more useful function, which might be used to debit a
+     bank account:
+
+<programlisting>
+CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
+    UPDATE bank
+        SET balance = balance - debit
+        WHERE accountno = tf1.accountno;
+    SELECT 1;
+$$ LANGUAGE SQL;
+</programlisting>
+
+     A user could execute this function to debit account 17 by $100.00 as
+     follows:
+
+<programlisting>
+SELECT tf1(17, 100.0);
+</programlisting>
+    </para>
+
+    <para>
+     In this example, we chose the name <literal>accountno</literal> for the first
+     argument, but this is the same as the name of a column in the
+     <literal>bank</literal> table.  Within the <command>UPDATE</command> command,
+     <literal>accountno</literal> refers to the column <literal>bank.accountno</literal>,
+     so <literal>tf1.accountno</literal> must be used to refer to the argument.
+     We could of course avoid this by using a different name for the argument.
+    </para>
+
+    <para>
+     In practice one would probably like a more useful result from the
+     function than a constant 1, so a more likely definition
+     is:
+
+<programlisting>
+CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
+    UPDATE bank
+        SET balance = balance - debit
+        WHERE accountno = tf1.accountno;
+    SELECT balance FROM bank WHERE accountno = tf1.accountno;
+$$ LANGUAGE SQL;
+</programlisting>
+
+     which adjusts the balance and returns the new balance.
+     The same thing could be done in one command using <literal>RETURNING</literal>:
+
+<programlisting>
+CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
+    UPDATE bank
+        SET balance = balance - debit
+        WHERE accountno = tf1.accountno
+    RETURNING balance;
+$$ LANGUAGE SQL;
+</programlisting>
+    </para>
+
+    <para>
+     A <acronym>SQL</acronym> function must return exactly its declared
+     result type.  This may require inserting an explicit cast.
+     For example, suppose we wanted the
+     previous <function>add_em</function> function to return
+     type <type>float8</type> instead.  This won't work:
+
+<programlisting>
+CREATE FUNCTION add_em(integer, integer) RETURNS float8 AS $$
+    SELECT $1 + $2;
+$$ LANGUAGE SQL;
+</programlisting>
+
+     even though in other contexts <productname>PostgreSQL</productname>
+     would be willing to insert an implicit cast to
+     convert <type>integer</type> to <type>float8</type>.
+     We need to write it as
+
+<programlisting>
+CREATE FUNCTION add_em(integer, integer) RETURNS float8 AS $$
+    SELECT ($1 + $2)::float8;
+$$ LANGUAGE SQL;
+</programlisting>
+    </para>
+   </sect2>
+
+   <sect2 id="xfunc-sql-composite-functions">
+    <title><acronym>SQL</acronym> Functions on Composite Types</title>
+
+    <para>
+     When writing functions with arguments of composite types, we must not
+     only specify which argument we want but also the desired attribute
+     (field) of that argument.  For example, suppose that
+     <type>emp</type> is a table containing employee data, and therefore
+     also the name of the composite type of each row of the table.  Here
+     is a function <function>double_salary</function> that computes what someone's
+     salary would be if it were doubled:
+
+<screen>
+CREATE TABLE emp (
+    name        text,
+    salary      numeric,
+    age         integer,
+    cubicle     point
+);
+
+INSERT INTO emp VALUES ('Bill', 4200, 45, '(2,1)');
+
+CREATE FUNCTION double_salary(emp) RETURNS numeric AS $$
+    SELECT $1.salary * 2 AS salary;
+$$ LANGUAGE SQL;
+
+SELECT name, double_salary(emp.*) AS dream
+    FROM emp
+    WHERE emp.cubicle ~= point '(2,1)';
+
+ name | dream
+------+-------
+ Bill |  8400
+</screen>
+    </para>
+
+    <para>
+     Notice the use of the syntax <literal>$1.salary</literal>
+     to select one field of the argument row value.  Also notice
+     how the calling <command>SELECT</command> command
+     uses <replaceable>table_name</replaceable><literal>.*</literal> to select
+     the entire current row of a table as a composite value.  The table
+     row can alternatively be referenced using just the table name,
+     like this:
+<screen>
+SELECT name, double_salary(emp) AS dream
+    FROM emp
+    WHERE emp.cubicle ~= point '(2,1)';
+</screen>
+     but this usage is deprecated since it's easy to get confused.
+     (See <xref linkend="rowtypes-usage"/> for details about these
+     two notations for the composite value of a table row.)
+    </para>
+
+    <para>
+     Sometimes it is handy to construct a composite argument value
+     on-the-fly.  This can be done with the <literal>ROW</literal> construct.
+     For example, we could adjust the data being passed to the function:
+<screen>
+SELECT name, double_salary(ROW(name, salary*1.1, age, cubicle)) AS dream
+    FROM emp;
+</screen>
+    </para>
+
+    <para>
+     It is also possible to build a function that returns a composite type.
+     This is an example of a function
+     that returns a single <type>emp</type> row:
+
+<programlisting>
+CREATE FUNCTION new_emp() RETURNS emp AS $$
+    SELECT text 'None' AS name,
+        1000.0 AS salary,
+        25 AS age,
+        point '(2,2)' AS cubicle;
+$$ LANGUAGE SQL;
+</programlisting>
+
+     In this example we have specified each of  the  attributes
+     with  a  constant value, but any computation
+     could have been substituted for these constants.
+    </para>
+
+    <para>
+     Note two important things about defining the function:
+
+     <itemizedlist>
+      <listitem>
+       <para>
+        The select list order in the query must be exactly the same as
+        that in which the columns appear in the table associated
+        with the composite type.  (Naming the columns, as we did above,
+        is irrelevant to the system.)
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        We must ensure each expression's type matches the corresponding
+        column of the composite type, inserting a cast if necessary.
+        Otherwise we'll get errors like this:
+<screen>
+<computeroutput>
+ERROR:  function declared to return emp returns varchar instead of text at column 1
+</computeroutput>
+</screen>
+        As with the base-type case, the function will not insert any casts
+        automatically.
+       </para>
+      </listitem>
+     </itemizedlist>
+    </para>
+
+    <para>
+     A different way to define the same function is:
+
+<programlisting>
+CREATE FUNCTION new_emp() RETURNS emp AS $$
+    SELECT ROW('None', 1000.0, 25, '(2,2)')::emp;
+$$ LANGUAGE SQL;
+</programlisting>
+
+     Here we wrote a <command>SELECT</command> that returns just a single
+     column of the correct composite type.  This isn't really better
+     in this situation, but it is a handy alternative in some cases
+     &mdash; for example, if we need to compute the result by calling
+     another function that returns the desired composite value.
+     Another example is that if we are trying to write a function that
+     returns a domain over composite, rather than a plain composite type,
+     it is always necessary to write it as returning a single column,
+     since there is no other way to produce a value that is exactly of
+     the domain type.
+    </para>
+
+    <para>
+     We could call this function directly either by using it in
+     a value expression:
+
+<screen>
+SELECT new_emp();
+
+         new_emp
+--------------------------
+ (None,1000.0,25,"(2,2)")
+</screen>
+
+     or by calling it as a table function:
+
+<screen>
+SELECT * FROM new_emp();
+
+ name | salary | age | cubicle
+------+--------+-----+---------
+ None | 1000.0 |  25 | (2,2)
+</screen>
+
+     The second way is described more fully in <xref
+     linkend="xfunc-sql-table-functions"/>.
+    </para>
+
+    <para>
+     When you use a function that returns a composite type,
+     you might want only one field (attribute) from its result.
+     You can do that with syntax like this:
+
+<screen>
+SELECT (new_emp()).name;
+
+ name
+------
+ None
+</screen>
+
+     The extra parentheses are needed to keep the parser from getting
+     confused.  If you try to do it without them, you get something like this:
+
+<screen>
+SELECT new_emp().name;
+ERROR:  syntax error at or near "."
+LINE 1: SELECT new_emp().name;
+                        ^
+</screen>
+    </para>
+
+    <para>
+     Another option is to use functional notation for extracting an attribute:
+
+<screen>
+SELECT name(new_emp());
+
+ name
+------
+ None
+</screen>
+
+     As explained in <xref linkend="rowtypes-usage"/>, the field notation and
+     functional notation are equivalent.
+    </para>
+
+    <para>
+     Another way to use a function returning a composite type is to pass the
+     result to another function that accepts the correct row type as input:
+
+<screen>
+CREATE FUNCTION getname(emp) RETURNS text AS $$
+    SELECT $1.name;
+$$ LANGUAGE SQL;
+
+SELECT getname(new_emp());
+ getname
+---------
+ None
+(1 row)
+</screen>
+    </para>
+   </sect2>
+
+   <sect2 id="xfunc-output-parameters">
+    <title><acronym>SQL</acronym> Functions with Output Parameters</title>
+
+   <indexterm>
+    <primary>function</primary>
+    <secondary>output parameter</secondary>
+   </indexterm>
+
+    <para>
+     An alternative way of describing a function's results is to define it
+     with <firstterm>output parameters</firstterm>, as in this example:
+
+<screen>
+CREATE FUNCTION add_em (IN x int, IN y int, OUT sum int)
+AS 'SELECT x + y'
+LANGUAGE SQL;
+
+SELECT add_em(3,7);
+ add_em
+--------
+     10
+(1 row)
+</screen>
+
+     This is not essentially different from the version of <literal>add_em</literal>
+     shown in <xref linkend="xfunc-sql-base-functions"/>.  The real value of
+     output parameters is that they provide a convenient way of defining
+     functions that return several columns.  For example,
+
+<screen>
+CREATE FUNCTION sum_n_product (x int, y int, OUT sum int, OUT product int)
+AS 'SELECT x + y, x * y'
+LANGUAGE SQL;
+
+ SELECT * FROM sum_n_product(11,42);
+ sum | product
+-----+---------
+  53 |     462
+(1 row)
+</screen>
+
+     What has essentially happened here is that we have created an anonymous
+     composite type for the result of the function.  The above example has
+     the same end result as
+
+<screen>
+CREATE TYPE sum_prod AS (sum int, product int);
+
+CREATE FUNCTION sum_n_product (int, int) RETURNS sum_prod
+AS 'SELECT $1 + $2, $1 * $2'
+LANGUAGE SQL;
+</screen>
+
+     but not having to bother with the separate composite type definition
+     is often handy.  Notice that the names attached to the output parameters
+     are not just decoration, but determine the column names of the anonymous
+     composite type.  (If you omit a name for an output parameter, the
+     system will choose a name on its own.)
+    </para>
+
+    <para>
+     Notice that output parameters are not included in the calling argument
+     list when invoking such a function from SQL.  This is because
+     <productname>PostgreSQL</productname> considers only the input
+     parameters to define the function's calling signature.  That means
+     also that only the input parameters matter when referencing the function
+     for purposes such as dropping it.  We could drop the above function
+     with either of
+
+<screen>
+DROP FUNCTION sum_n_product (x int, y int, OUT sum int, OUT product int);
+DROP FUNCTION sum_n_product (int, int);
+</screen>
+    </para>
+
+    <para>
+     Parameters can be marked as <literal>IN</literal> (the default),
+     <literal>OUT</literal>, <literal>INOUT</literal>, or <literal>VARIADIC</literal>.
+     An <literal>INOUT</literal>
+     parameter serves as both an input parameter (part of the calling
+     argument list) and an output parameter (part of the result record type).
+     <literal>VARIADIC</literal> parameters are input parameters, but are treated
+     specially as described next.
+    </para>
+   </sect2>
+
+   <sect2 id="xfunc-sql-variadic-functions">
+    <title><acronym>SQL</acronym> Functions with Variable Numbers of Arguments</title>
+
+    <indexterm>
+     <primary>function</primary>
+     <secondary>variadic</secondary>
+    </indexterm>
+
+    <indexterm>
+     <primary>variadic function</primary>
+    </indexterm>
+
+    <para>
+     <acronym>SQL</acronym> functions can be declared to accept
+     variable numbers of arguments, so long as all the <quote>optional</quote>
+     arguments are of the same data type.  The optional arguments will be
+     passed to the function as an array.  The function is declared by
+     marking the last parameter as <literal>VARIADIC</literal>; this parameter
+     must be declared as being of an array type.  For example:
+
+<screen>
+CREATE FUNCTION mleast(VARIADIC arr numeric[]) RETURNS numeric AS $$
+    SELECT min($1[i]) FROM generate_subscripts($1, 1) g(i);
+$$ LANGUAGE SQL;
+
+SELECT mleast(10, -1, 5, 4.4);
+ mleast 
+--------
+     -1
+(1 row)
+</screen>
+
+     Effectively, all the actual arguments at or beyond the
+     <literal>VARIADIC</literal> position are gathered up into a one-dimensional
+     array, as if you had written
+
+<screen>
+SELECT mleast(ARRAY[10, -1, 5, 4.4]);    -- doesn't work
+</screen>
+
+     You can't actually write that, though &mdash; or at least, it will
+     not match this function definition.  A parameter marked
+     <literal>VARIADIC</literal> matches one or more occurrences of its element
+     type, not of its own type.
+    </para>
+
+    <para>
+     Sometimes it is useful to be able to pass an already-constructed array
+     to a variadic function; this is particularly handy when one variadic
+     function wants to pass on its array parameter to another one.  Also,
+     this is the only secure way to call a variadic function found in a schema
+     that permits untrusted users to create objects; see
+     <xref linkend="typeconv-func"/>.  You can do this by
+     specifying <literal>VARIADIC</literal> in the call:
+
+<screen>
+SELECT mleast(VARIADIC ARRAY[10, -1, 5, 4.4]);
+</screen>
+
+     This prevents expansion of the function's variadic parameter into its
+     element type, thereby allowing the array argument value to match
+     normally.  <literal>VARIADIC</literal> can only be attached to the last
+     actual argument of a function call.
+    </para>
+
+    <para>
+     Specifying <literal>VARIADIC</literal> in the call is also the only way to
+     pass an empty array to a variadic function, for example:
+
+<screen>
+SELECT mleast(VARIADIC ARRAY[]::numeric[]);
+</screen>
+
+     Simply writing <literal>SELECT mleast()</literal> does not work because a
+     variadic parameter must match at least one actual argument.
+     (You could define a second function also named <literal>mleast</literal>,
+     with no parameters, if you wanted to allow such calls.)
+    </para>
+
+    <para>
+     The array element parameters generated from a variadic parameter are
+     treated as not having any names of their own.  This means it is not
+     possible to call a variadic function using named arguments (<xref
+     linkend="sql-syntax-calling-funcs"/>), except when you specify
+     <literal>VARIADIC</literal>.  For example, this will work:
+
+<screen>
+SELECT mleast(VARIADIC arr =&gt; ARRAY[10, -1, 5, 4.4]);
+</screen>
+
+     but not these:
+
+<screen>
+SELECT mleast(arr =&gt; 10);
+SELECT mleast(arr =&gt; ARRAY[10, -1, 5, 4.4]);
+</screen>
+    </para>
+   </sect2>
+
+   <sect2 id="xfunc-sql-parameter-defaults">
+    <title><acronym>SQL</acronym> Functions with Default Values for Arguments</title>
+
+    <indexterm>
+     <primary>function</primary>
+     <secondary>default values for arguments</secondary>
+    </indexterm>
+
+    <para>
+     Functions can be declared with default values for some or all input
+     arguments.  The default values are inserted whenever the function is
+     called with insufficiently many actual arguments.  Since arguments
+     can only be omitted from the end of the actual argument list, all
+     parameters after a parameter with a default value have to have
+     default values as well.  (Although the use of named argument notation
+     could allow this restriction to be relaxed, it's still enforced so that
+     positional argument notation works sensibly.)  Whether or not you use it,
+     this capability creates a need for precautions when calling functions in
+     databases where some users mistrust other users; see
+     <xref linkend="typeconv-func"/>.
+    </para>
+
+    <para>
+     For example:
+<screen>
+CREATE FUNCTION foo(a int, b int DEFAULT 2, c int DEFAULT 3)
+RETURNS int
+LANGUAGE SQL
+AS $$
+    SELECT $1 + $2 + $3;
+$$;
+
+SELECT foo(10, 20, 30);
+ foo 
+-----
+  60
+(1 row)
+
+SELECT foo(10, 20);
+ foo 
+-----
+  33
+(1 row)
+
+SELECT foo(10);
+ foo 
+-----
+  15
+(1 row)
+
+SELECT foo();  -- fails since there is no default for the first argument
+ERROR:  function foo() does not exist
+</screen>
+     The <literal>=</literal> sign can also be used in place of the
+     key word <literal>DEFAULT</literal>.
+    </para>
+   </sect2>
+
+   <sect2 id="xfunc-sql-table-functions">
+    <title><acronym>SQL</acronym> Functions as Table Sources</title>
+
+    <para>
+     All SQL functions can be used in the <literal>FROM</literal> clause of a query,
+     but it is particularly useful for functions returning composite types.
+     If the function is defined to return a base type, the table function
+     produces a one-column table.  If the function is defined to return
+     a composite type, the table function produces a column for each attribute
+     of the composite type.
+    </para>
+
+    <para>
+     Here is an example:
+
+<screen>
+CREATE TABLE foo (fooid int, foosubid int, fooname text);
+INSERT INTO foo VALUES (1, 1, 'Joe');
+INSERT INTO foo VALUES (1, 2, 'Ed');
+INSERT INTO foo VALUES (2, 1, 'Mary');
+
+CREATE FUNCTION getfoo(int) RETURNS foo AS $$
+    SELECT * FROM foo WHERE fooid = $1;
+$$ LANGUAGE SQL;
+
+SELECT *, upper(fooname) FROM getfoo(1) AS t1;
+
+ fooid | foosubid | fooname | upper
+-------+----------+---------+-------
+     1 |        1 | Joe     | JOE
+(1 row)
+</screen>
+
+     As the example shows, we can work with the columns of the function's
+     result just the same as if they were columns of a regular table.
+    </para>
+
+    <para>
+     Note that we only got one row out of the function.  This is because
+     we did not use <literal>SETOF</literal>.  That is described in the next section.
+    </para>
+   </sect2>
+
+   <sect2 id="xfunc-sql-functions-returning-set">
+    <title><acronym>SQL</acronym> Functions Returning Sets</title>
+
+    <indexterm>
+     <primary>function</primary>
+     <secondary>with SETOF</secondary>
+    </indexterm>
+
+    <para>
+     When an SQL function is declared as returning <literal>SETOF
+     <replaceable>sometype</replaceable></literal>, the function's final
+     query is executed to completion, and each row it
+     outputs is returned as an element of the result set.
+    </para>
+
+    <para>
+     This feature is normally used when calling the function in the <literal>FROM</literal>
+     clause.  In this case each row returned by the function becomes
+     a row of the table seen by the query.  For example, assume that
+     table <literal>foo</literal> has the same contents as above, and we say:
+
+<programlisting>
+CREATE FUNCTION getfoo(int) RETURNS SETOF foo AS $$
+    SELECT * FROM foo WHERE fooid = $1;
+$$ LANGUAGE SQL;
+
+SELECT * FROM getfoo(1) AS t1;
+</programlisting>
+
+     Then we would get:
+<screen>
+ fooid | foosubid | fooname
+-------+----------+---------
+     1 |        1 | Joe
+     1 |        2 | Ed
+(2 rows)
+</screen>
+    </para>
+
+    <para>
+     It is also possible to return multiple rows with the columns defined by
+     output parameters, like this:
+
+<programlisting>
+CREATE TABLE tab (y int, z int);
+INSERT INTO tab VALUES (1, 2), (3, 4), (5, 6), (7, 8);
+
+CREATE FUNCTION sum_n_product_with_tab (x int, OUT sum int, OUT product int)
+RETURNS SETOF record
+AS $$
+    SELECT $1 + tab.y, $1 * tab.y FROM tab;
+$$ LANGUAGE SQL;
+
+SELECT * FROM sum_n_product_with_tab(10);
+ sum | product
+-----+---------
+  11 |      10
+  13 |      30
+  15 |      50
+  17 |      70
+(4 rows)
+</programlisting>
+
+     The key point here is that you must write <literal>RETURNS SETOF record</literal>
+     to indicate that the function returns multiple rows instead of just one.
+     If there is only one output parameter, write that parameter's type
+     instead of <type>record</type>.
+    </para>
+
+    <para>
+     It is frequently useful to construct a query's result by invoking a
+     set-returning function multiple times, with the parameters for each
+     invocation coming from successive rows of a table or subquery.  The
+     preferred way to do this is to use the <literal>LATERAL</literal> key word,
+     which is described in <xref linkend="queries-lateral"/>.
+     Here is an example using a set-returning function to enumerate
+     elements of a tree structure:
+
+<screen>
+SELECT * FROM nodes;
+   name    | parent
+-----------+--------
+ Top       |
+ Child1    | Top
+ Child2    | Top
+ Child3    | Top
+ SubChild1 | Child1
+ SubChild2 | Child1
+(6 rows)
+
+CREATE FUNCTION listchildren(text) RETURNS SETOF text AS $$
+    SELECT name FROM nodes WHERE parent = $1
+$$ LANGUAGE SQL STABLE;
+
+SELECT * FROM listchildren('Top');
+ listchildren
+--------------
+ Child1
+ Child2
+ Child3
+(3 rows)
+
+SELECT name, child FROM nodes, LATERAL listchildren(name) AS child;
+  name  |   child
+--------+-----------
+ Top    | Child1
+ Top    | Child2
+ Top    | Child3
+ Child1 | SubChild1
+ Child1 | SubChild2
+(5 rows)
+</screen>
+
+     This example does not do anything that we couldn't have done with a
+     simple join, but in more complex calculations the option to put
+     some of the work into a function can be quite convenient.
+    </para>
+
+    <para>
+     Functions returning sets can also be called in the select list
+     of a query.  For each row that the query
+     generates by itself, the set-returning function is invoked, and an output
+     row is generated for each element of the function's result set.
+     The previous example could also be done with queries like
+     these:
+
+<screen>
+SELECT listchildren('Top');
+ listchildren
+--------------
+ Child1
+ Child2
+ Child3
+(3 rows)
+
+SELECT name, listchildren(name) FROM nodes;
+  name  | listchildren
+--------+--------------
+ Top    | Child1
+ Top    | Child2
+ Top    | Child3
+ Child1 | SubChild1
+ Child1 | SubChild2
+(5 rows)
+</screen>
+
+     In the last <command>SELECT</command>,
+     notice that no output row appears for <literal>Child2</literal>, <literal>Child3</literal>, etc.
+     This happens because <function>listchildren</function> returns an empty set
+     for those arguments, so no result rows are generated.  This is the same
+     behavior as we got from an inner join to the function result when using
+     the <literal>LATERAL</literal> syntax.
+    </para>
+
+    <para>
+     <productname>PostgreSQL</productname>'s behavior for a set-returning function in a
+     query's select list is almost exactly the same as if the set-returning
+     function had been written in a <literal>LATERAL FROM</literal>-clause item
+     instead.  For example,
+<programlisting>
+SELECT x, generate_series(1,5) AS g FROM tab;
+</programlisting>
+     is almost equivalent to
+<programlisting>
+SELECT x, g FROM tab, LATERAL generate_series(1,5) AS g;
+</programlisting>
+     It would be exactly the same, except that in this specific example,
+     the planner could choose to put <structname>g</structname> on the outside of the
+     nestloop join, since <structname>g</structname> has no actual lateral dependency
+     on <structname>tab</structname>.  That would result in a different output row
+     order.  Set-returning functions in the select list are always evaluated
+     as though they are on the inside of a nestloop join with the rest of
+     the <literal>FROM</literal> clause, so that the function(s) are run to
+     completion before the next row from the <literal>FROM</literal> clause is
+     considered.
+    </para>
+
+    <para>
+     If there is more than one set-returning function in the query's select
+     list, the behavior is similar to what you get from putting the functions
+     into a single <literal>LATERAL ROWS FROM( ... )</literal> <literal>FROM</literal>-clause
+     item.  For each row from the underlying query, there is an output row
+     using the first result from each function, then an output row using the
+     second result, and so on.  If some of the set-returning functions
+     produce fewer outputs than others, null values are substituted for the
+     missing data, so that the total number of rows emitted for one
+     underlying row is the same as for the set-returning function that
+     produced the most outputs.  Thus the set-returning functions
+     run <quote>in lockstep</quote> until they are all exhausted, and then
+     execution continues with the next underlying row.
+    </para>
+
+    <para>
+     Set-returning functions can be nested in a select list, although that is
+     not allowed in <literal>FROM</literal>-clause items.  In such cases, each level
+     of nesting is treated separately, as though it were
+     a separate <literal>LATERAL ROWS FROM( ... )</literal> item.  For example, in
+<programlisting>
+SELECT srf1(srf2(x), srf3(y)), srf4(srf5(z)) FROM tab;
+</programlisting>
+     the set-returning functions <function>srf2</function>, <function>srf3</function>,
+     and <function>srf5</function> would be run in lockstep for each row
+     of <structname>tab</structname>, and then <function>srf1</function> and <function>srf4</function>
+     would be applied in lockstep to each row produced by the lower
+     functions.
+    </para>
+
+    <para>
+     Set-returning functions cannot be used within conditional-evaluation
+     constructs, such as <literal>CASE</literal> or <literal>COALESCE</literal>.  For
+     example, consider
+<programlisting>
+SELECT x, CASE WHEN x &gt; 0 THEN generate_series(1, 5) ELSE 0 END FROM tab;
+</programlisting>
+     It might seem that this should produce five repetitions of input rows
+     that have <literal>x &gt; 0</literal>, and a single repetition of those that do
+     not; but actually, because <function>generate_series(1, 5)</function> would be
+     run in an implicit <literal>LATERAL FROM</literal> item before
+     the <literal>CASE</literal> expression is ever evaluated, it would produce five
+     repetitions of every input row.  To reduce confusion, such cases produce
+     a parse-time error instead.
+    </para>
+
+    <note>
+     <para>
+      If a function's last command is <command>INSERT</command>, <command>UPDATE</command>,
+      or <command>DELETE</command> with <literal>RETURNING</literal>, that command will
+      always be executed to completion, even if the function is not declared
+      with <literal>SETOF</literal> or the calling query does not fetch all the
+      result rows.  Any extra rows produced by the <literal>RETURNING</literal>
+      clause are silently dropped, but the commanded table modifications
+      still happen (and are all completed before returning from the function).
+     </para>
+    </note>
+
+    <note>
+     <para>
+      Before <productname>PostgreSQL</productname> 10, putting more than one
+      set-returning function in the same select list did not behave very
+      sensibly unless they always produced equal numbers of rows.  Otherwise,
+      what you got was a number of output rows equal to the least common
+      multiple of the numbers of rows produced by the set-returning
+      functions.  Also, nested set-returning functions did not work as
+      described above; instead, a set-returning function could have at most
+      one set-returning argument, and each nest of set-returning functions
+      was run independently.  Also, conditional execution (set-returning
+      functions inside <literal>CASE</literal> etc) was previously allowed,
+      complicating things even more.
+      Use of the <literal>LATERAL</literal> syntax is recommended when writing
+      queries that need to work in older <productname>PostgreSQL</productname> versions,
+      because that will give consistent results across different versions.
+      If you have a query that is relying on conditional execution of a
+      set-returning function, you may be able to fix it by moving the
+      conditional test into a custom set-returning function.  For example,
+<programlisting>
+SELECT x, CASE WHEN y &gt; 0 THEN generate_series(1, z) ELSE 5 END FROM tab;
+</programlisting>
+      could become
+<programlisting>
+CREATE FUNCTION case_generate_series(cond bool, start int, fin int, els int)
+  RETURNS SETOF int AS $$
+BEGIN
+  IF cond THEN
+    RETURN QUERY SELECT generate_series(start, fin);
+  ELSE
+    RETURN QUERY SELECT els;
+  END IF;
+END$$ LANGUAGE plpgsql;
+
+SELECT x, case_generate_series(y &gt; 0, 1, z, 5) FROM tab;
+</programlisting>
+      This formulation will work the same in all versions
+      of <productname>PostgreSQL</productname>.
+     </para>
+    </note>
+   </sect2>
+
+   <sect2 id="xfunc-sql-functions-returning-table">
+    <title><acronym>SQL</acronym> Functions Returning <literal>TABLE</literal></title>
+
+    <indexterm>
+     <primary>function</primary>
+     <secondary>RETURNS TABLE</secondary>
+    </indexterm>
+
+    <para>
+     There is another way to declare a function as returning a set,
+     which is to use the syntax
+     <literal>RETURNS TABLE(<replaceable>columns</replaceable>)</literal>.
+     This is equivalent to using one or more <literal>OUT</literal> parameters plus
+     marking the function as returning <literal>SETOF record</literal> (or
+     <literal>SETOF</literal> a single output parameter's type, as appropriate).
+     This notation is specified in recent versions of the SQL standard, and
+     thus may be more portable than using <literal>SETOF</literal>.
+    </para>
+
+    <para>
+     For example, the preceding sum-and-product example could also be
+     done this way:
+
+<programlisting>
+CREATE FUNCTION sum_n_product_with_tab (x int)
+RETURNS TABLE(sum int, product int) AS $$
+    SELECT $1 + tab.y, $1 * tab.y FROM tab;
+$$ LANGUAGE SQL;
+</programlisting>
+
+     It is not allowed to use explicit <literal>OUT</literal> or <literal>INOUT</literal>
+     parameters with the <literal>RETURNS TABLE</literal> notation &mdash; you must
+     put all the output columns in the <literal>TABLE</literal> list.
+    </para>
+   </sect2>
+
+   <sect2>
+    <title>Polymorphic <acronym>SQL</acronym> Functions</title>
+
+    <para>
+     <acronym>SQL</acronym> functions can be declared to accept and
+     return the polymorphic types <type>anyelement</type>,
+     <type>anyarray</type>, <type>anynonarray</type>,
+     <type>anyenum</type>, and <type>anyrange</type>.  See <xref
+     linkend="extend-types-polymorphic"/> for a more detailed
+     explanation of polymorphic functions. Here is a polymorphic
+     function <function>make_array</function> that builds up an array
+     from two arbitrary data type elements:
+<screen>
+CREATE FUNCTION make_array(anyelement, anyelement) RETURNS anyarray AS $$
+    SELECT ARRAY[$1, $2];
+$$ LANGUAGE SQL;
+
+SELECT make_array(1, 2) AS intarray, make_array('a'::text, 'b') AS textarray;
+ intarray | textarray
+----------+-----------
+ {1,2}    | {a,b}
+(1 row)
+</screen>
+    </para>
+
+    <para>
+     Notice the use of the typecast <literal>'a'::text</literal>
+     to specify that the argument is of type <type>text</type>. This is
+     required if the argument is just a string literal, since otherwise
+     it would be treated as type
+     <type>unknown</type>, and array of <type>unknown</type> is not a valid
+     type.
+     Without the typecast, you will get errors like this:
+<screen>
+<computeroutput>
+ERROR:  could not determine polymorphic type because input has type "unknown"
+</computeroutput>
+</screen>
+    </para>
+
+    <para>
+     It is permitted to have polymorphic arguments with a fixed
+     return type, but the converse is not. For example:
+<screen>
+CREATE FUNCTION is_greater(anyelement, anyelement) RETURNS boolean AS $$
+    SELECT $1 &gt; $2;
+$$ LANGUAGE SQL;
+
+SELECT is_greater(1, 2);
+ is_greater
+------------
+ f
+(1 row)
+
+CREATE FUNCTION invalid_func() RETURNS anyelement AS $$
+    SELECT 1;
+$$ LANGUAGE SQL;
+ERROR:  cannot determine result data type
+DETAIL:  A function returning a polymorphic type must have at least one polymorphic argument.
+</screen>
+    </para>
+
+    <para>
+     Polymorphism can be used with functions that have output arguments.
+     For example:
+<screen>
+CREATE FUNCTION dup (f1 anyelement, OUT f2 anyelement, OUT f3 anyarray)
+AS 'select $1, array[$1,$1]' LANGUAGE SQL;
+
+SELECT * FROM dup(22);
+ f2 |   f3
+----+---------
+ 22 | {22,22}
+(1 row)
+</screen>
+    </para>
+
+    <para>
+     Polymorphism can also be used with variadic functions.
+     For example:
+<screen>
+CREATE FUNCTION anyleast (VARIADIC anyarray) RETURNS anyelement AS $$
+    SELECT min($1[i]) FROM generate_subscripts($1, 1) g(i);
+$$ LANGUAGE SQL;
+
+SELECT anyleast(10, -1, 5, 4);
+ anyleast 
+----------
+       -1
+(1 row)
+
+SELECT anyleast('abc'::text, 'def');
+ anyleast 
+----------
+ abc
+(1 row)
+
+CREATE FUNCTION concat_values(text, VARIADIC anyarray) RETURNS text AS $$
+    SELECT array_to_string($2, $1);
+$$ LANGUAGE SQL;
+
+SELECT concat_values('|', 1, 4, 2);
+ concat_values 
+---------------
+ 1|4|2
+(1 row)
+</screen>
+    </para>
+   </sect2>
+
+   <sect2>
+    <title><acronym>SQL</acronym> Functions with Collations</title>
+
+    <indexterm>
+     <primary>collation</primary>
+     <secondary>in SQL functions</secondary>
+    </indexterm>
+
+    <para>
+     When a SQL function has one or more parameters of collatable data types,
+     a collation is identified for each function call depending on the
+     collations assigned to the actual arguments, as described in <xref
+     linkend="collation"/>.  If a collation is successfully identified
+     (i.e., there are no conflicts of implicit collations among the arguments)
+     then all the collatable parameters are treated as having that collation
+     implicitly.  This will affect the behavior of collation-sensitive
+     operations within the function.  For example, using the
+     <function>anyleast</function> function described above, the result of
+<programlisting>
+SELECT anyleast('abc'::text, 'ABC');
+</programlisting>
+     will depend on the database's default collation.  In <literal>C</literal> locale
+     the result will be <literal>ABC</literal>, but in many other locales it will
+     be <literal>abc</literal>.  The collation to use can be forced by adding
+     a <literal>COLLATE</literal> clause to any of the arguments, for example
+<programlisting>
+SELECT anyleast('abc'::text, 'ABC' COLLATE "C");
+</programlisting>
+     Alternatively, if you wish a function to operate with a particular
+     collation regardless of what it is called with, insert
+     <literal>COLLATE</literal> clauses as needed in the function definition.
+     This version of <function>anyleast</function> would always use <literal>en_US</literal>
+     locale to compare strings:
+<programlisting>
+CREATE FUNCTION anyleast (VARIADIC anyarray) RETURNS anyelement AS $$
+    SELECT min($1[i] COLLATE "en_US") FROM generate_subscripts($1, 1) g(i);
+$$ LANGUAGE SQL;
+</programlisting>
+     But note that this will throw an error if applied to a non-collatable
+     data type.
+    </para>
+
+    <para>
+     If no common collation can be identified among the actual arguments,
+     then a SQL function treats its parameters as having their data types'
+     default collation (which is usually the database's default collation,
+     but could be different for parameters of domain types).
+    </para>
+
+    <para>
+     The behavior of collatable parameters can be thought of as a limited
+     form of polymorphism, applicable only to textual data types.
+    </para>
+   </sect2>
+  </sect1>
+
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index e18272c33a..f400400168 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -1,1701 +1,5 @@
 <!-- doc/src/sgml/xfunc.sgml -->
 
- <sect1 id="xfunc">
-  <title>User-defined Functions</title>
-
-  <indexterm zone="xfunc">
-   <primary>function</primary>
-   <secondary>user-defined</secondary>
-  </indexterm>
-
-  <para>
-   <productname>PostgreSQL</productname> provides four kinds of
-   functions:
-
-   <itemizedlist>
-    <listitem>
-     <para>
-      query language functions (functions written in
-      <acronym>SQL</acronym>) (<xref linkend="xfunc-sql"/>)
-     </para>
-    </listitem>
-    <listitem>
-     <para>
-      procedural language functions (functions written in, for
-      example, <application>PL/pgSQL</application> or <application>PL/Tcl</application>)
-      (<xref linkend="xfunc-pl"/>)
-     </para>
-    </listitem>
-    <listitem>
-     <para>
-      internal functions (<xref linkend="xfunc-internal"/>)
-     </para>
-    </listitem>
-    <listitem>
-     <para>
-      C-language functions (<xref linkend="xfunc-c"/>)
-     </para>
-    </listitem>
-   </itemizedlist>
-  </para>
-
-  <para>
-   Every kind
-   of  function  can take base types, composite types, or
-   combinations of these as arguments (parameters). In addition,
-   every kind of function can return a base type or
-   a composite type.  Functions can also be defined to return
-   sets of base or composite values.
-  </para>
-
-  <para>
-   Many kinds of functions can take or return certain pseudo-types
-   (such as polymorphic types), but the available facilities vary.
-   Consult the description of each kind of function for more details.
-  </para>
-
-  <para>
-   It's easiest to define <acronym>SQL</acronym>
-   functions, so we'll start by discussing those.
-   Most of the concepts presented for <acronym>SQL</acronym> functions
-   will carry over to the other types of functions.
-  </para>
-
-  <para>
-   Throughout this chapter, it can be useful to look at the reference
-   page of the <xref linkend="sql-createfunction"/> command to
-   understand the examples better.  Some examples from this chapter
-   can be found in <filename>funcs.sql</filename> and
-   <filename>funcs.c</filename> in the <filename>src/tutorial</filename>
-   directory in the <productname>PostgreSQL</productname> source
-   distribution.
-  </para>
-  </sect1>
-
-  <sect1 id="xproc">
-   <title>User-defined Procedures</title>
-
-  <indexterm zone="xproc">
-   <primary>procedure</primary>
-   <secondary>user-defined</secondary>
-  </indexterm>
-
-   <para>
-    A procedure is a database object similar to a function.  The difference is
-    that a procedure does not return a value, so there is no return type
-    declaration.  While a function is called as part of a query or DML
-    command, a procedure is called explicitly using
-    the <xref linkend="sql-call"/> statement.
-   </para>
-
-   <para>
-    The explanations on how to define user-defined functions in the rest of
-    this chapter apply to procedures as well, except that
-    the <xref linkend="sql-createprocedure"/> command is used instead, there is
-    no return type, and some other features such as strictness don't apply.
-   </para>
-
-   <para>
-    Collectively, functions and procedures are also known
-    as <firstterm>routines</firstterm><indexterm><primary>routine</primary></indexterm>.
-    There are commands such as <xref linkend="sql-alterroutine"/>
-    and <xref linkend="sql-droproutine"/> that can operate on functions and
-    procedures without having to know which kind it is.  Note, however, that
-    there is no <literal>CREATE ROUTINE</literal> command.
-   </para>
-  </sect1>
-
-  <sect1 id="xfunc-sql">
-   <title>Query Language (<acronym>SQL</acronym>) Functions</title>
-
-   <indexterm zone="xfunc-sql">
-    <primary>function</primary>
-    <secondary>user-defined</secondary>
-    <tertiary>in SQL</tertiary>
-   </indexterm>
-
-   <para>
-    SQL functions execute an arbitrary list of SQL statements, returning
-    the result of the last query in the list.
-    In the simple (non-set)
-    case, the first row of the last query's result will be returned.
-    (Bear in mind that <quote>the first row</quote> of a multirow
-    result is not well-defined unless you use <literal>ORDER BY</literal>.)
-    If the last query happens
-    to return no rows at all, the null value will be returned.
-   </para>
-
-   <para>
-    Alternatively, an SQL function can be declared to return a set (that is,
-    multiple rows) by specifying the function's return type as <literal>SETOF
-    <replaceable>sometype</replaceable></literal>, or equivalently by declaring it as
-    <literal>RETURNS TABLE(<replaceable>columns</replaceable>)</literal>.  In this case
-    all rows of the last query's result are returned.  Further details appear
-    below.
-   </para>
-
-   <para>
-    The body of an SQL function must be a list of SQL
-    statements separated by semicolons.  A semicolon after the last
-    statement is optional.  Unless the function is declared to return
-    <type>void</type>, the last statement must be a <command>SELECT</command>,
-    or an <command>INSERT</command>, <command>UPDATE</command>, or <command>DELETE</command>
-    that has a <literal>RETURNING</literal> clause.
-   </para>
-
-    <para>
-     Any collection of commands in the  <acronym>SQL</acronym>
-     language can be packaged together and defined as a function.
-     Besides <command>SELECT</command> queries, the commands can include data
-     modification queries (<command>INSERT</command>,
-     <command>UPDATE</command>, and <command>DELETE</command>), as well as
-     other SQL commands. (You cannot use transaction control commands, e.g.
-     <command>COMMIT</command>, <command>SAVEPOINT</command>, and some utility
-     commands, e.g.  <literal>VACUUM</literal>, in <acronym>SQL</acronym> functions.)
-     However, the final command
-     must be a <command>SELECT</command> or have a <literal>RETURNING</literal>
-     clause that returns whatever is
-     specified as the function's return type.  Alternatively, if you
-     want to define a SQL function that performs actions but has no
-     useful value to return, you can define it as returning <type>void</type>.
-     For example, this function removes rows with negative salaries from
-     the <literal>emp</literal> table:
-
-<screen>
-CREATE FUNCTION clean_emp() RETURNS void AS '
-    DELETE FROM emp
-        WHERE salary &lt; 0;
-' LANGUAGE SQL;
-
-SELECT clean_emp();
-
- clean_emp
------------
-
-(1 row)
-</screen>
-    </para>
-
-    <note>
-     <para>
-      The entire body of a SQL function is parsed before any of it is
-      executed.  While a SQL function can contain commands that alter
-      the system catalogs (e.g., <command>CREATE TABLE</command>), the effects
-      of such commands will not be visible during parse analysis of
-      later commands in the function.  Thus, for example,
-      <literal>CREATE TABLE foo (...); INSERT INTO foo VALUES(...);</literal>
-      will not work as desired if packaged up into a single SQL function,
-      since <structname>foo</structname> won't exist yet when the <command>INSERT</command>
-      command is parsed.  It's recommended to use <application>PL/pgSQL</application>
-      instead of a SQL function in this type of situation.
-     </para>
-   </note>
-
-   <para>
-    The syntax of the <command>CREATE FUNCTION</command> command requires
-    the function body to be written as a string constant.  It is usually
-    most convenient to use dollar quoting (see <xref
-    linkend="sql-syntax-dollar-quoting"/>) for the string constant.
-    If you choose to use regular single-quoted string constant syntax,
-    you must double single quote marks (<literal>'</literal>) and backslashes
-    (<literal>\</literal>) (assuming escape string syntax) in the body of
-    the function (see <xref linkend="sql-syntax-strings"/>).
-   </para>
-
-   <sect2 id="xfunc-sql-function-arguments">
-    <title>Arguments for <acronym>SQL</acronym> Functions</title>
-
-   <indexterm>
-    <primary>function</primary>
-    <secondary>named argument</secondary>
-   </indexterm>
-
-    <para>
-     Arguments of a SQL function can be referenced in the function
-     body using either names or numbers.  Examples of both methods appear
-     below.
-    </para>
-
-    <para>
-     To use a name, declare the function argument as having a name, and
-     then just write that name in the function body.  If the argument name
-     is the same as any column name in the current SQL command within the
-     function, the column name will take precedence.  To override this,
-     qualify the argument name with the name of the function itself, that is
-     <literal><replaceable>function_name</replaceable>.<replaceable>argument_name</replaceable></literal>.
-     (If this would conflict with a qualified column name, again the column
-     name wins.  You can avoid the ambiguity by choosing a different alias for
-     the table within the SQL command.)
-    </para>
-
-    <para>
-     In the older numeric approach, arguments are referenced using the syntax
-     <literal>$<replaceable>n</replaceable></literal>: <literal>$1</literal> refers to the first input
-     argument, <literal>$2</literal> to the second, and so on.  This will work
-     whether or not the particular argument was declared with a name.
-    </para>
-
-    <para>
-     If an argument is of a composite type, then the dot notation,
-     e.g., <literal><replaceable>argname</replaceable>.<replaceable>fieldname</replaceable></literal> or
-     <literal>$1.<replaceable>fieldname</replaceable></literal>, can be used to access attributes of the
-     argument.  Again, you might need to qualify the argument's name with the
-     function name to make the form with an argument name unambiguous.
-    </para>
-
-    <para>
-     SQL function arguments can only be used as data values,
-     not as identifiers.  Thus for example this is reasonable:
-<programlisting>
-INSERT INTO mytable VALUES ($1);
-</programlisting>
-but this will not work:
-<programlisting>
-INSERT INTO $1 VALUES (42);
-</programlisting>
-    </para>
-
-    <note>
-     <para>
-      The ability to use names to reference SQL function arguments was added
-      in <productname>PostgreSQL</productname> 9.2.  Functions to be used in
-      older servers must use the <literal>$<replaceable>n</replaceable></literal> notation.
-     </para>
-    </note>
-   </sect2>
-
-   <sect2 id="xfunc-sql-base-functions">
-    <title><acronym>SQL</acronym> Functions on Base Types</title>
-
-    <para>
-     The simplest possible <acronym>SQL</acronym> function has no arguments and
-     simply returns a base type, such as <type>integer</type>:
-
-<screen>
-CREATE FUNCTION one() RETURNS integer AS $$
-    SELECT 1 AS result;
-$$ LANGUAGE SQL;
-
--- Alternative syntax for string literal:
-CREATE FUNCTION one() RETURNS integer AS '
-    SELECT 1 AS result;
-' LANGUAGE SQL;
-
-SELECT one();
-
- one
------
-   1
-</screen>
-    </para>
-
-    <para>
-     Notice that we defined a column alias within the function body for the result of the function
-     (with  the  name <literal>result</literal>),  but this column alias is not visible
-     outside the function.  Hence,  the  result  is labeled <literal>one</literal>
-     instead of <literal>result</literal>.
-    </para>
-
-    <para>
-     It is almost as easy to define <acronym>SQL</acronym> functions
-     that take base types as arguments:
-
-<screen>
-CREATE FUNCTION add_em(x integer, y integer) RETURNS integer AS $$
-    SELECT x + y;
-$$ LANGUAGE SQL;
-
-SELECT add_em(1, 2) AS answer;
-
- answer
---------
-      3
-</screen>
-    </para>
-
-    <para>
-     Alternatively, we could dispense with names for the arguments and
-     use numbers:
-
-<screen>
-CREATE FUNCTION add_em(integer, integer) RETURNS integer AS $$
-    SELECT $1 + $2;
-$$ LANGUAGE SQL;
-
-SELECT add_em(1, 2) AS answer;
-
- answer
---------
-      3
-</screen>
-    </para>
-
-    <para>
-     Here is a more useful function, which might be used to debit a
-     bank account:
-
-<programlisting>
-CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
-    UPDATE bank
-        SET balance = balance - debit
-        WHERE accountno = tf1.accountno;
-    SELECT 1;
-$$ LANGUAGE SQL;
-</programlisting>
-
-     A user could execute this function to debit account 17 by $100.00 as
-     follows:
-
-<programlisting>
-SELECT tf1(17, 100.0);
-</programlisting>
-    </para>
-
-    <para>
-     In this example, we chose the name <literal>accountno</literal> for the first
-     argument, but this is the same as the name of a column in the
-     <literal>bank</literal> table.  Within the <command>UPDATE</command> command,
-     <literal>accountno</literal> refers to the column <literal>bank.accountno</literal>,
-     so <literal>tf1.accountno</literal> must be used to refer to the argument.
-     We could of course avoid this by using a different name for the argument.
-    </para>
-
-    <para>
-     In practice one would probably like a more useful result from the
-     function than a constant 1, so a more likely definition
-     is:
-
-<programlisting>
-CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
-    UPDATE bank
-        SET balance = balance - debit
-        WHERE accountno = tf1.accountno;
-    SELECT balance FROM bank WHERE accountno = tf1.accountno;
-$$ LANGUAGE SQL;
-</programlisting>
-
-     which adjusts the balance and returns the new balance.
-     The same thing could be done in one command using <literal>RETURNING</literal>:
-
-<programlisting>
-CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
-    UPDATE bank
-        SET balance = balance - debit
-        WHERE accountno = tf1.accountno
-    RETURNING balance;
-$$ LANGUAGE SQL;
-</programlisting>
-    </para>
-
-    <para>
-     A <acronym>SQL</acronym> function must return exactly its declared
-     result type.  This may require inserting an explicit cast.
-     For example, suppose we wanted the
-     previous <function>add_em</function> function to return
-     type <type>float8</type> instead.  This won't work:
-
-<programlisting>
-CREATE FUNCTION add_em(integer, integer) RETURNS float8 AS $$
-    SELECT $1 + $2;
-$$ LANGUAGE SQL;
-</programlisting>
-
-     even though in other contexts <productname>PostgreSQL</productname>
-     would be willing to insert an implicit cast to
-     convert <type>integer</type> to <type>float8</type>.
-     We need to write it as
-
-<programlisting>
-CREATE FUNCTION add_em(integer, integer) RETURNS float8 AS $$
-    SELECT ($1 + $2)::float8;
-$$ LANGUAGE SQL;
-</programlisting>
-    </para>
-   </sect2>
-
-   <sect2 id="xfunc-sql-composite-functions">
-    <title><acronym>SQL</acronym> Functions on Composite Types</title>
-
-    <para>
-     When writing functions with arguments of composite types, we must not
-     only specify which argument we want but also the desired attribute
-     (field) of that argument.  For example, suppose that
-     <type>emp</type> is a table containing employee data, and therefore
-     also the name of the composite type of each row of the table.  Here
-     is a function <function>double_salary</function> that computes what someone's
-     salary would be if it were doubled:
-
-<screen>
-CREATE TABLE emp (
-    name        text,
-    salary      numeric,
-    age         integer,
-    cubicle     point
-);
-
-INSERT INTO emp VALUES ('Bill', 4200, 45, '(2,1)');
-
-CREATE FUNCTION double_salary(emp) RETURNS numeric AS $$
-    SELECT $1.salary * 2 AS salary;
-$$ LANGUAGE SQL;
-
-SELECT name, double_salary(emp.*) AS dream
-    FROM emp
-    WHERE emp.cubicle ~= point '(2,1)';
-
- name | dream
-------+-------
- Bill |  8400
-</screen>
-    </para>
-
-    <para>
-     Notice the use of the syntax <literal>$1.salary</literal>
-     to select one field of the argument row value.  Also notice
-     how the calling <command>SELECT</command> command
-     uses <replaceable>table_name</replaceable><literal>.*</literal> to select
-     the entire current row of a table as a composite value.  The table
-     row can alternatively be referenced using just the table name,
-     like this:
-<screen>
-SELECT name, double_salary(emp) AS dream
-    FROM emp
-    WHERE emp.cubicle ~= point '(2,1)';
-</screen>
-     but this usage is deprecated since it's easy to get confused.
-     (See <xref linkend="rowtypes-usage"/> for details about these
-     two notations for the composite value of a table row.)
-    </para>
-
-    <para>
-     Sometimes it is handy to construct a composite argument value
-     on-the-fly.  This can be done with the <literal>ROW</literal> construct.
-     For example, we could adjust the data being passed to the function:
-<screen>
-SELECT name, double_salary(ROW(name, salary*1.1, age, cubicle)) AS dream
-    FROM emp;
-</screen>
-    </para>
-
-    <para>
-     It is also possible to build a function that returns a composite type.
-     This is an example of a function
-     that returns a single <type>emp</type> row:
-
-<programlisting>
-CREATE FUNCTION new_emp() RETURNS emp AS $$
-    SELECT text 'None' AS name,
-        1000.0 AS salary,
-        25 AS age,
-        point '(2,2)' AS cubicle;
-$$ LANGUAGE SQL;
-</programlisting>
-
-     In this example we have specified each of  the  attributes
-     with  a  constant value, but any computation
-     could have been substituted for these constants.
-    </para>
-
-    <para>
-     Note two important things about defining the function:
-
-     <itemizedlist>
-      <listitem>
-       <para>
-        The select list order in the query must be exactly the same as
-        that in which the columns appear in the table associated
-        with the composite type.  (Naming the columns, as we did above,
-        is irrelevant to the system.)
-       </para>
-      </listitem>
-      <listitem>
-       <para>
-        We must ensure each expression's type matches the corresponding
-        column of the composite type, inserting a cast if necessary.
-        Otherwise we'll get errors like this:
-<screen>
-<computeroutput>
-ERROR:  function declared to return emp returns varchar instead of text at column 1
-</computeroutput>
-</screen>
-        As with the base-type case, the function will not insert any casts
-        automatically.
-       </para>
-      </listitem>
-     </itemizedlist>
-    </para>
-
-    <para>
-     A different way to define the same function is:
-
-<programlisting>
-CREATE FUNCTION new_emp() RETURNS emp AS $$
-    SELECT ROW('None', 1000.0, 25, '(2,2)')::emp;
-$$ LANGUAGE SQL;
-</programlisting>
-
-     Here we wrote a <command>SELECT</command> that returns just a single
-     column of the correct composite type.  This isn't really better
-     in this situation, but it is a handy alternative in some cases
-     &mdash; for example, if we need to compute the result by calling
-     another function that returns the desired composite value.
-     Another example is that if we are trying to write a function that
-     returns a domain over composite, rather than a plain composite type,
-     it is always necessary to write it as returning a single column,
-     since there is no other way to produce a value that is exactly of
-     the domain type.
-    </para>
-
-    <para>
-     We could call this function directly either by using it in
-     a value expression:
-
-<screen>
-SELECT new_emp();
-
-         new_emp
---------------------------
- (None,1000.0,25,"(2,2)")
-</screen>
-
-     or by calling it as a table function:
-
-<screen>
-SELECT * FROM new_emp();
-
- name | salary | age | cubicle
-------+--------+-----+---------
- None | 1000.0 |  25 | (2,2)
-</screen>
-
-     The second way is described more fully in <xref
-     linkend="xfunc-sql-table-functions"/>.
-    </para>
-
-    <para>
-     When you use a function that returns a composite type,
-     you might want only one field (attribute) from its result.
-     You can do that with syntax like this:
-
-<screen>
-SELECT (new_emp()).name;
-
- name
-------
- None
-</screen>
-
-     The extra parentheses are needed to keep the parser from getting
-     confused.  If you try to do it without them, you get something like this:
-
-<screen>
-SELECT new_emp().name;
-ERROR:  syntax error at or near "."
-LINE 1: SELECT new_emp().name;
-                        ^
-</screen>
-    </para>
-
-    <para>
-     Another option is to use functional notation for extracting an attribute:
-
-<screen>
-SELECT name(new_emp());
-
- name
-------
- None
-</screen>
-
-     As explained in <xref linkend="rowtypes-usage"/>, the field notation and
-     functional notation are equivalent.
-    </para>
-
-    <para>
-     Another way to use a function returning a composite type is to pass the
-     result to another function that accepts the correct row type as input:
-
-<screen>
-CREATE FUNCTION getname(emp) RETURNS text AS $$
-    SELECT $1.name;
-$$ LANGUAGE SQL;
-
-SELECT getname(new_emp());
- getname
----------
- None
-(1 row)
-</screen>
-    </para>
-   </sect2>
-
-   <sect2 id="xfunc-output-parameters">
-    <title><acronym>SQL</acronym> Functions with Output Parameters</title>
-
-   <indexterm>
-    <primary>function</primary>
-    <secondary>output parameter</secondary>
-   </indexterm>
-
-    <para>
-     An alternative way of describing a function's results is to define it
-     with <firstterm>output parameters</firstterm>, as in this example:
-
-<screen>
-CREATE FUNCTION add_em (IN x int, IN y int, OUT sum int)
-AS 'SELECT x + y'
-LANGUAGE SQL;
-
-SELECT add_em(3,7);
- add_em
---------
-     10
-(1 row)
-</screen>
-
-     This is not essentially different from the version of <literal>add_em</literal>
-     shown in <xref linkend="xfunc-sql-base-functions"/>.  The real value of
-     output parameters is that they provide a convenient way of defining
-     functions that return several columns.  For example,
-
-<screen>
-CREATE FUNCTION sum_n_product (x int, y int, OUT sum int, OUT product int)
-AS 'SELECT x + y, x * y'
-LANGUAGE SQL;
-
- SELECT * FROM sum_n_product(11,42);
- sum | product
------+---------
-  53 |     462
-(1 row)
-</screen>
-
-     What has essentially happened here is that we have created an anonymous
-     composite type for the result of the function.  The above example has
-     the same end result as
-
-<screen>
-CREATE TYPE sum_prod AS (sum int, product int);
-
-CREATE FUNCTION sum_n_product (int, int) RETURNS sum_prod
-AS 'SELECT $1 + $2, $1 * $2'
-LANGUAGE SQL;
-</screen>
-
-     but not having to bother with the separate composite type definition
-     is often handy.  Notice that the names attached to the output parameters
-     are not just decoration, but determine the column names of the anonymous
-     composite type.  (If you omit a name for an output parameter, the
-     system will choose a name on its own.)
-    </para>
-
-    <para>
-     Notice that output parameters are not included in the calling argument
-     list when invoking such a function from SQL.  This is because
-     <productname>PostgreSQL</productname> considers only the input
-     parameters to define the function's calling signature.  That means
-     also that only the input parameters matter when referencing the function
-     for purposes such as dropping it.  We could drop the above function
-     with either of
-
-<screen>
-DROP FUNCTION sum_n_product (x int, y int, OUT sum int, OUT product int);
-DROP FUNCTION sum_n_product (int, int);
-</screen>
-    </para>
-
-    <para>
-     Parameters can be marked as <literal>IN</literal> (the default),
-     <literal>OUT</literal>, <literal>INOUT</literal>, or <literal>VARIADIC</literal>.
-     An <literal>INOUT</literal>
-     parameter serves as both an input parameter (part of the calling
-     argument list) and an output parameter (part of the result record type).
-     <literal>VARIADIC</literal> parameters are input parameters, but are treated
-     specially as described next.
-    </para>
-   </sect2>
-
-   <sect2 id="xfunc-sql-variadic-functions">
-    <title><acronym>SQL</acronym> Functions with Variable Numbers of Arguments</title>
-
-    <indexterm>
-     <primary>function</primary>
-     <secondary>variadic</secondary>
-    </indexterm>
-
-    <indexterm>
-     <primary>variadic function</primary>
-    </indexterm>
-
-    <para>
-     <acronym>SQL</acronym> functions can be declared to accept
-     variable numbers of arguments, so long as all the <quote>optional</quote>
-     arguments are of the same data type.  The optional arguments will be
-     passed to the function as an array.  The function is declared by
-     marking the last parameter as <literal>VARIADIC</literal>; this parameter
-     must be declared as being of an array type.  For example:
-
-<screen>
-CREATE FUNCTION mleast(VARIADIC arr numeric[]) RETURNS numeric AS $$
-    SELECT min($1[i]) FROM generate_subscripts($1, 1) g(i);
-$$ LANGUAGE SQL;
-
-SELECT mleast(10, -1, 5, 4.4);
- mleast 
---------
-     -1
-(1 row)
-</screen>
-
-     Effectively, all the actual arguments at or beyond the
-     <literal>VARIADIC</literal> position are gathered up into a one-dimensional
-     array, as if you had written
-
-<screen>
-SELECT mleast(ARRAY[10, -1, 5, 4.4]);    -- doesn't work
-</screen>
-
-     You can't actually write that, though &mdash; or at least, it will
-     not match this function definition.  A parameter marked
-     <literal>VARIADIC</literal> matches one or more occurrences of its element
-     type, not of its own type.
-    </para>
-
-    <para>
-     Sometimes it is useful to be able to pass an already-constructed array
-     to a variadic function; this is particularly handy when one variadic
-     function wants to pass on its array parameter to another one.  Also,
-     this is the only secure way to call a variadic function found in a schema
-     that permits untrusted users to create objects; see
-     <xref linkend="typeconv-func"/>.  You can do this by
-     specifying <literal>VARIADIC</literal> in the call:
-
-<screen>
-SELECT mleast(VARIADIC ARRAY[10, -1, 5, 4.4]);
-</screen>
-
-     This prevents expansion of the function's variadic parameter into its
-     element type, thereby allowing the array argument value to match
-     normally.  <literal>VARIADIC</literal> can only be attached to the last
-     actual argument of a function call.
-    </para>
-
-    <para>
-     Specifying <literal>VARIADIC</literal> in the call is also the only way to
-     pass an empty array to a variadic function, for example:
-
-<screen>
-SELECT mleast(VARIADIC ARRAY[]::numeric[]);
-</screen>
-
-     Simply writing <literal>SELECT mleast()</literal> does not work because a
-     variadic parameter must match at least one actual argument.
-     (You could define a second function also named <literal>mleast</literal>,
-     with no parameters, if you wanted to allow such calls.)
-    </para>
-
-    <para>
-     The array element parameters generated from a variadic parameter are
-     treated as not having any names of their own.  This means it is not
-     possible to call a variadic function using named arguments (<xref
-     linkend="sql-syntax-calling-funcs"/>), except when you specify
-     <literal>VARIADIC</literal>.  For example, this will work:
-
-<screen>
-SELECT mleast(VARIADIC arr =&gt; ARRAY[10, -1, 5, 4.4]);
-</screen>
-
-     but not these:
-
-<screen>
-SELECT mleast(arr =&gt; 10);
-SELECT mleast(arr =&gt; ARRAY[10, -1, 5, 4.4]);
-</screen>
-    </para>
-   </sect2>
-
-   <sect2 id="xfunc-sql-parameter-defaults">
-    <title><acronym>SQL</acronym> Functions with Default Values for Arguments</title>
-
-    <indexterm>
-     <primary>function</primary>
-     <secondary>default values for arguments</secondary>
-    </indexterm>
-
-    <para>
-     Functions can be declared with default values for some or all input
-     arguments.  The default values are inserted whenever the function is
-     called with insufficiently many actual arguments.  Since arguments
-     can only be omitted from the end of the actual argument list, all
-     parameters after a parameter with a default value have to have
-     default values as well.  (Although the use of named argument notation
-     could allow this restriction to be relaxed, it's still enforced so that
-     positional argument notation works sensibly.)  Whether or not you use it,
-     this capability creates a need for precautions when calling functions in
-     databases where some users mistrust other users; see
-     <xref linkend="typeconv-func"/>.
-    </para>
-
-    <para>
-     For example:
-<screen>
-CREATE FUNCTION foo(a int, b int DEFAULT 2, c int DEFAULT 3)
-RETURNS int
-LANGUAGE SQL
-AS $$
-    SELECT $1 + $2 + $3;
-$$;
-
-SELECT foo(10, 20, 30);
- foo 
------
-  60
-(1 row)
-
-SELECT foo(10, 20);
- foo 
------
-  33
-(1 row)
-
-SELECT foo(10);
- foo 
------
-  15
-(1 row)
-
-SELECT foo();  -- fails since there is no default for the first argument
-ERROR:  function foo() does not exist
-</screen>
-     The <literal>=</literal> sign can also be used in place of the
-     key word <literal>DEFAULT</literal>.
-    </para>
-   </sect2>
-
-   <sect2 id="xfunc-sql-table-functions">
-    <title><acronym>SQL</acronym> Functions as Table Sources</title>
-
-    <para>
-     All SQL functions can be used in the <literal>FROM</literal> clause of a query,
-     but it is particularly useful for functions returning composite types.
-     If the function is defined to return a base type, the table function
-     produces a one-column table.  If the function is defined to return
-     a composite type, the table function produces a column for each attribute
-     of the composite type.
-    </para>
-
-    <para>
-     Here is an example:
-
-<screen>
-CREATE TABLE foo (fooid int, foosubid int, fooname text);
-INSERT INTO foo VALUES (1, 1, 'Joe');
-INSERT INTO foo VALUES (1, 2, 'Ed');
-INSERT INTO foo VALUES (2, 1, 'Mary');
-
-CREATE FUNCTION getfoo(int) RETURNS foo AS $$
-    SELECT * FROM foo WHERE fooid = $1;
-$$ LANGUAGE SQL;
-
-SELECT *, upper(fooname) FROM getfoo(1) AS t1;
-
- fooid | foosubid | fooname | upper
--------+----------+---------+-------
-     1 |        1 | Joe     | JOE
-(1 row)
-</screen>
-
-     As the example shows, we can work with the columns of the function's
-     result just the same as if they were columns of a regular table.
-    </para>
-
-    <para>
-     Note that we only got one row out of the function.  This is because
-     we did not use <literal>SETOF</literal>.  That is described in the next section.
-    </para>
-   </sect2>
-
-   <sect2 id="xfunc-sql-functions-returning-set">
-    <title><acronym>SQL</acronym> Functions Returning Sets</title>
-
-    <indexterm>
-     <primary>function</primary>
-     <secondary>with SETOF</secondary>
-    </indexterm>
-
-    <para>
-     When an SQL function is declared as returning <literal>SETOF
-     <replaceable>sometype</replaceable></literal>, the function's final
-     query is executed to completion, and each row it
-     outputs is returned as an element of the result set.
-    </para>
-
-    <para>
-     This feature is normally used when calling the function in the <literal>FROM</literal>
-     clause.  In this case each row returned by the function becomes
-     a row of the table seen by the query.  For example, assume that
-     table <literal>foo</literal> has the same contents as above, and we say:
-
-<programlisting>
-CREATE FUNCTION getfoo(int) RETURNS SETOF foo AS $$
-    SELECT * FROM foo WHERE fooid = $1;
-$$ LANGUAGE SQL;
-
-SELECT * FROM getfoo(1) AS t1;
-</programlisting>
-
-     Then we would get:
-<screen>
- fooid | foosubid | fooname
--------+----------+---------
-     1 |        1 | Joe
-     1 |        2 | Ed
-(2 rows)
-</screen>
-    </para>
-
-    <para>
-     It is also possible to return multiple rows with the columns defined by
-     output parameters, like this:
-
-<programlisting>
-CREATE TABLE tab (y int, z int);
-INSERT INTO tab VALUES (1, 2), (3, 4), (5, 6), (7, 8);
-
-CREATE FUNCTION sum_n_product_with_tab (x int, OUT sum int, OUT product int)
-RETURNS SETOF record
-AS $$
-    SELECT $1 + tab.y, $1 * tab.y FROM tab;
-$$ LANGUAGE SQL;
-
-SELECT * FROM sum_n_product_with_tab(10);
- sum | product
------+---------
-  11 |      10
-  13 |      30
-  15 |      50
-  17 |      70
-(4 rows)
-</programlisting>
-
-     The key point here is that you must write <literal>RETURNS SETOF record</literal>
-     to indicate that the function returns multiple rows instead of just one.
-     If there is only one output parameter, write that parameter's type
-     instead of <type>record</type>.
-    </para>
-
-    <para>
-     It is frequently useful to construct a query's result by invoking a
-     set-returning function multiple times, with the parameters for each
-     invocation coming from successive rows of a table or subquery.  The
-     preferred way to do this is to use the <literal>LATERAL</literal> key word,
-     which is described in <xref linkend="queries-lateral"/>.
-     Here is an example using a set-returning function to enumerate
-     elements of a tree structure:
-
-<screen>
-SELECT * FROM nodes;
-   name    | parent
------------+--------
- Top       |
- Child1    | Top
- Child2    | Top
- Child3    | Top
- SubChild1 | Child1
- SubChild2 | Child1
-(6 rows)
-
-CREATE FUNCTION listchildren(text) RETURNS SETOF text AS $$
-    SELECT name FROM nodes WHERE parent = $1
-$$ LANGUAGE SQL STABLE;
-
-SELECT * FROM listchildren('Top');
- listchildren
---------------
- Child1
- Child2
- Child3
-(3 rows)
-
-SELECT name, child FROM nodes, LATERAL listchildren(name) AS child;
-  name  |   child
---------+-----------
- Top    | Child1
- Top    | Child2
- Top    | Child3
- Child1 | SubChild1
- Child1 | SubChild2
-(5 rows)
-</screen>
-
-     This example does not do anything that we couldn't have done with a
-     simple join, but in more complex calculations the option to put
-     some of the work into a function can be quite convenient.
-    </para>
-
-    <para>
-     Functions returning sets can also be called in the select list
-     of a query.  For each row that the query
-     generates by itself, the set-returning function is invoked, and an output
-     row is generated for each element of the function's result set.
-     The previous example could also be done with queries like
-     these:
-
-<screen>
-SELECT listchildren('Top');
- listchildren
---------------
- Child1
- Child2
- Child3
-(3 rows)
-
-SELECT name, listchildren(name) FROM nodes;
-  name  | listchildren
---------+--------------
- Top    | Child1
- Top    | Child2
- Top    | Child3
- Child1 | SubChild1
- Child1 | SubChild2
-(5 rows)
-</screen>
-
-     In the last <command>SELECT</command>,
-     notice that no output row appears for <literal>Child2</literal>, <literal>Child3</literal>, etc.
-     This happens because <function>listchildren</function> returns an empty set
-     for those arguments, so no result rows are generated.  This is the same
-     behavior as we got from an inner join to the function result when using
-     the <literal>LATERAL</literal> syntax.
-    </para>
-
-    <para>
-     <productname>PostgreSQL</productname>'s behavior for a set-returning function in a
-     query's select list is almost exactly the same as if the set-returning
-     function had been written in a <literal>LATERAL FROM</literal>-clause item
-     instead.  For example,
-<programlisting>
-SELECT x, generate_series(1,5) AS g FROM tab;
-</programlisting>
-     is almost equivalent to
-<programlisting>
-SELECT x, g FROM tab, LATERAL generate_series(1,5) AS g;
-</programlisting>
-     It would be exactly the same, except that in this specific example,
-     the planner could choose to put <structname>g</structname> on the outside of the
-     nestloop join, since <structname>g</structname> has no actual lateral dependency
-     on <structname>tab</structname>.  That would result in a different output row
-     order.  Set-returning functions in the select list are always evaluated
-     as though they are on the inside of a nestloop join with the rest of
-     the <literal>FROM</literal> clause, so that the function(s) are run to
-     completion before the next row from the <literal>FROM</literal> clause is
-     considered.
-    </para>
-
-    <para>
-     If there is more than one set-returning function in the query's select
-     list, the behavior is similar to what you get from putting the functions
-     into a single <literal>LATERAL ROWS FROM( ... )</literal> <literal>FROM</literal>-clause
-     item.  For each row from the underlying query, there is an output row
-     using the first result from each function, then an output row using the
-     second result, and so on.  If some of the set-returning functions
-     produce fewer outputs than others, null values are substituted for the
-     missing data, so that the total number of rows emitted for one
-     underlying row is the same as for the set-returning function that
-     produced the most outputs.  Thus the set-returning functions
-     run <quote>in lockstep</quote> until they are all exhausted, and then
-     execution continues with the next underlying row.
-    </para>
-
-    <para>
-     Set-returning functions can be nested in a select list, although that is
-     not allowed in <literal>FROM</literal>-clause items.  In such cases, each level
-     of nesting is treated separately, as though it were
-     a separate <literal>LATERAL ROWS FROM( ... )</literal> item.  For example, in
-<programlisting>
-SELECT srf1(srf2(x), srf3(y)), srf4(srf5(z)) FROM tab;
-</programlisting>
-     the set-returning functions <function>srf2</function>, <function>srf3</function>,
-     and <function>srf5</function> would be run in lockstep for each row
-     of <structname>tab</structname>, and then <function>srf1</function> and <function>srf4</function>
-     would be applied in lockstep to each row produced by the lower
-     functions.
-    </para>
-
-    <para>
-     Set-returning functions cannot be used within conditional-evaluation
-     constructs, such as <literal>CASE</literal> or <literal>COALESCE</literal>.  For
-     example, consider
-<programlisting>
-SELECT x, CASE WHEN x &gt; 0 THEN generate_series(1, 5) ELSE 0 END FROM tab;
-</programlisting>
-     It might seem that this should produce five repetitions of input rows
-     that have <literal>x &gt; 0</literal>, and a single repetition of those that do
-     not; but actually, because <function>generate_series(1, 5)</function> would be
-     run in an implicit <literal>LATERAL FROM</literal> item before
-     the <literal>CASE</literal> expression is ever evaluated, it would produce five
-     repetitions of every input row.  To reduce confusion, such cases produce
-     a parse-time error instead.
-    </para>
-
-    <note>
-     <para>
-      If a function's last command is <command>INSERT</command>, <command>UPDATE</command>,
-      or <command>DELETE</command> with <literal>RETURNING</literal>, that command will
-      always be executed to completion, even if the function is not declared
-      with <literal>SETOF</literal> or the calling query does not fetch all the
-      result rows.  Any extra rows produced by the <literal>RETURNING</literal>
-      clause are silently dropped, but the commanded table modifications
-      still happen (and are all completed before returning from the function).
-     </para>
-    </note>
-
-    <note>
-     <para>
-      Before <productname>PostgreSQL</productname> 10, putting more than one
-      set-returning function in the same select list did not behave very
-      sensibly unless they always produced equal numbers of rows.  Otherwise,
-      what you got was a number of output rows equal to the least common
-      multiple of the numbers of rows produced by the set-returning
-      functions.  Also, nested set-returning functions did not work as
-      described above; instead, a set-returning function could have at most
-      one set-returning argument, and each nest of set-returning functions
-      was run independently.  Also, conditional execution (set-returning
-      functions inside <literal>CASE</literal> etc) was previously allowed,
-      complicating things even more.
-      Use of the <literal>LATERAL</literal> syntax is recommended when writing
-      queries that need to work in older <productname>PostgreSQL</productname> versions,
-      because that will give consistent results across different versions.
-      If you have a query that is relying on conditional execution of a
-      set-returning function, you may be able to fix it by moving the
-      conditional test into a custom set-returning function.  For example,
-<programlisting>
-SELECT x, CASE WHEN y &gt; 0 THEN generate_series(1, z) ELSE 5 END FROM tab;
-</programlisting>
-      could become
-<programlisting>
-CREATE FUNCTION case_generate_series(cond bool, start int, fin int, els int)
-  RETURNS SETOF int AS $$
-BEGIN
-  IF cond THEN
-    RETURN QUERY SELECT generate_series(start, fin);
-  ELSE
-    RETURN QUERY SELECT els;
-  END IF;
-END$$ LANGUAGE plpgsql;
-
-SELECT x, case_generate_series(y &gt; 0, 1, z, 5) FROM tab;
-</programlisting>
-      This formulation will work the same in all versions
-      of <productname>PostgreSQL</productname>.
-     </para>
-    </note>
-   </sect2>
-
-   <sect2 id="xfunc-sql-functions-returning-table">
-    <title><acronym>SQL</acronym> Functions Returning <literal>TABLE</literal></title>
-
-    <indexterm>
-     <primary>function</primary>
-     <secondary>RETURNS TABLE</secondary>
-    </indexterm>
-
-    <para>
-     There is another way to declare a function as returning a set,
-     which is to use the syntax
-     <literal>RETURNS TABLE(<replaceable>columns</replaceable>)</literal>.
-     This is equivalent to using one or more <literal>OUT</literal> parameters plus
-     marking the function as returning <literal>SETOF record</literal> (or
-     <literal>SETOF</literal> a single output parameter's type, as appropriate).
-     This notation is specified in recent versions of the SQL standard, and
-     thus may be more portable than using <literal>SETOF</literal>.
-    </para>
-
-    <para>
-     For example, the preceding sum-and-product example could also be
-     done this way:
-
-<programlisting>
-CREATE FUNCTION sum_n_product_with_tab (x int)
-RETURNS TABLE(sum int, product int) AS $$
-    SELECT $1 + tab.y, $1 * tab.y FROM tab;
-$$ LANGUAGE SQL;
-</programlisting>
-
-     It is not allowed to use explicit <literal>OUT</literal> or <literal>INOUT</literal>
-     parameters with the <literal>RETURNS TABLE</literal> notation &mdash; you must
-     put all the output columns in the <literal>TABLE</literal> list.
-    </para>
-   </sect2>
-
-   <sect2>
-    <title>Polymorphic <acronym>SQL</acronym> Functions</title>
-
-    <para>
-     <acronym>SQL</acronym> functions can be declared to accept and
-     return the polymorphic types <type>anyelement</type>,
-     <type>anyarray</type>, <type>anynonarray</type>,
-     <type>anyenum</type>, and <type>anyrange</type>.  See <xref
-     linkend="extend-types-polymorphic"/> for a more detailed
-     explanation of polymorphic functions. Here is a polymorphic
-     function <function>make_array</function> that builds up an array
-     from two arbitrary data type elements:
-<screen>
-CREATE FUNCTION make_array(anyelement, anyelement) RETURNS anyarray AS $$
-    SELECT ARRAY[$1, $2];
-$$ LANGUAGE SQL;
-
-SELECT make_array(1, 2) AS intarray, make_array('a'::text, 'b') AS textarray;
- intarray | textarray
-----------+-----------
- {1,2}    | {a,b}
-(1 row)
-</screen>
-    </para>
-
-    <para>
-     Notice the use of the typecast <literal>'a'::text</literal>
-     to specify that the argument is of type <type>text</type>. This is
-     required if the argument is just a string literal, since otherwise
-     it would be treated as type
-     <type>unknown</type>, and array of <type>unknown</type> is not a valid
-     type.
-     Without the typecast, you will get errors like this:
-<screen>
-<computeroutput>
-ERROR:  could not determine polymorphic type because input has type "unknown"
-</computeroutput>
-</screen>
-    </para>
-
-    <para>
-     It is permitted to have polymorphic arguments with a fixed
-     return type, but the converse is not. For example:
-<screen>
-CREATE FUNCTION is_greater(anyelement, anyelement) RETURNS boolean AS $$
-    SELECT $1 &gt; $2;
-$$ LANGUAGE SQL;
-
-SELECT is_greater(1, 2);
- is_greater
-------------
- f
-(1 row)
-
-CREATE FUNCTION invalid_func() RETURNS anyelement AS $$
-    SELECT 1;
-$$ LANGUAGE SQL;
-ERROR:  cannot determine result data type
-DETAIL:  A function returning a polymorphic type must have at least one polymorphic argument.
-</screen>
-    </para>
-
-    <para>
-     Polymorphism can be used with functions that have output arguments.
-     For example:
-<screen>
-CREATE FUNCTION dup (f1 anyelement, OUT f2 anyelement, OUT f3 anyarray)
-AS 'select $1, array[$1,$1]' LANGUAGE SQL;
-
-SELECT * FROM dup(22);
- f2 |   f3
-----+---------
- 22 | {22,22}
-(1 row)
-</screen>
-    </para>
-
-    <para>
-     Polymorphism can also be used with variadic functions.
-     For example:
-<screen>
-CREATE FUNCTION anyleast (VARIADIC anyarray) RETURNS anyelement AS $$
-    SELECT min($1[i]) FROM generate_subscripts($1, 1) g(i);
-$$ LANGUAGE SQL;
-
-SELECT anyleast(10, -1, 5, 4);
- anyleast 
-----------
-       -1
-(1 row)
-
-SELECT anyleast('abc'::text, 'def');
- anyleast 
-----------
- abc
-(1 row)
-
-CREATE FUNCTION concat_values(text, VARIADIC anyarray) RETURNS text AS $$
-    SELECT array_to_string($2, $1);
-$$ LANGUAGE SQL;
-
-SELECT concat_values('|', 1, 4, 2);
- concat_values 
----------------
- 1|4|2
-(1 row)
-</screen>
-    </para>
-   </sect2>
-
-   <sect2>
-    <title><acronym>SQL</acronym> Functions with Collations</title>
-
-    <indexterm>
-     <primary>collation</primary>
-     <secondary>in SQL functions</secondary>
-    </indexterm>
-
-    <para>
-     When a SQL function has one or more parameters of collatable data types,
-     a collation is identified for each function call depending on the
-     collations assigned to the actual arguments, as described in <xref
-     linkend="collation"/>.  If a collation is successfully identified
-     (i.e., there are no conflicts of implicit collations among the arguments)
-     then all the collatable parameters are treated as having that collation
-     implicitly.  This will affect the behavior of collation-sensitive
-     operations within the function.  For example, using the
-     <function>anyleast</function> function described above, the result of
-<programlisting>
-SELECT anyleast('abc'::text, 'ABC');
-</programlisting>
-     will depend on the database's default collation.  In <literal>C</literal> locale
-     the result will be <literal>ABC</literal>, but in many other locales it will
-     be <literal>abc</literal>.  The collation to use can be forced by adding
-     a <literal>COLLATE</literal> clause to any of the arguments, for example
-<programlisting>
-SELECT anyleast('abc'::text, 'ABC' COLLATE "C");
-</programlisting>
-     Alternatively, if you wish a function to operate with a particular
-     collation regardless of what it is called with, insert
-     <literal>COLLATE</literal> clauses as needed in the function definition.
-     This version of <function>anyleast</function> would always use <literal>en_US</literal>
-     locale to compare strings:
-<programlisting>
-CREATE FUNCTION anyleast (VARIADIC anyarray) RETURNS anyelement AS $$
-    SELECT min($1[i] COLLATE "en_US") FROM generate_subscripts($1, 1) g(i);
-$$ LANGUAGE SQL;
-</programlisting>
-     But note that this will throw an error if applied to a non-collatable
-     data type.
-    </para>
-
-    <para>
-     If no common collation can be identified among the actual arguments,
-     then a SQL function treats its parameters as having their data types'
-     default collation (which is usually the database's default collation,
-     but could be different for parameters of domain types).
-    </para>
-
-    <para>
-     The behavior of collatable parameters can be thought of as a limited
-     form of polymorphism, applicable only to textual data types.
-    </para>
-   </sect2>
-  </sect1>
-
-  <sect1 id="xfunc-overload">
-   <title>Function Overloading</title>
-
-   <indexterm zone="xfunc-overload">
-    <primary>overloading</primary>
-    <secondary>functions</secondary>
-   </indexterm>
-
-   <para>
-    More than one function can be defined with the same SQL name, so long
-    as the arguments they take are different.  In other words,
-    function names can be <firstterm>overloaded</firstterm>.  Whether or not
-    you use it, this capability entails security precautions when calling
-    functions in databases where some users mistrust other users; see
-    <xref linkend="typeconv-func"/>.  When a query is executed, the server
-    will determine which function to call from the data types and the number
-    of the provided arguments.  Overloading can also be used to simulate
-    functions with a variable number of arguments, up to a finite maximum
-    number.
-   </para>
-
-   <para>
-    When creating a family of overloaded functions, one should be
-    careful not to create ambiguities.  For instance, given the
-    functions:
-<programlisting>
-CREATE FUNCTION test(int, real) RETURNS ...
-CREATE FUNCTION test(smallint, double precision) RETURNS ...
-</programlisting>
-    it is not immediately clear which function would be called with
-    some trivial input like <literal>test(1, 1.5)</literal>.  The
-    currently implemented resolution rules are described in
-    <xref linkend="typeconv"/>, but it is unwise to design a system that subtly
-    relies on this behavior.
-   </para>
-
-   <para>
-    A function that takes a single argument of a composite type should
-    generally not have the same name as any attribute (field) of that type.
-    Recall that <literal><replaceable>attribute</replaceable>(<replaceable>table</replaceable>)</literal>
-    is considered equivalent
-    to <literal><replaceable>table</replaceable>.<replaceable>attribute</replaceable></literal>.
-    In the case that there is an
-    ambiguity between a function on a composite type and an attribute of
-    the composite type, the attribute will always be used.  It is possible
-    to override that choice by schema-qualifying the function name
-    (that is, <literal><replaceable>schema</replaceable>.<replaceable>func</replaceable>(<replaceable>table</replaceable>)
-    </literal>) but it's better to
-    avoid the problem by not choosing conflicting names.
-   </para>
-
-   <para>
-    Another possible conflict is between variadic and non-variadic functions.
-    For instance, it is possible to create both <literal>foo(numeric)</literal> and
-    <literal>foo(VARIADIC numeric[])</literal>.  In this case it is unclear which one
-    should be matched to a call providing a single numeric argument, such as
-    <literal>foo(10.1)</literal>.  The rule is that the function appearing
-    earlier in the search path is used, or if the two functions are in the
-    same schema, the non-variadic one is preferred.
-   </para>
-
-   <para>
-    When overloading C-language functions, there is an additional
-    constraint: The C name of each function in the family of
-    overloaded functions must be different from the C names of all
-    other functions, either internal or dynamically loaded.  If this
-    rule is violated, the behavior is not portable.  You might get a
-    run-time linker error, or one of the functions will get called
-    (usually the internal one).  The alternative form of the
-    <literal>AS</literal> clause for the SQL <command>CREATE
-    FUNCTION</command> command decouples the SQL function name from
-    the function name in the C source code.  For instance:
-<programlisting>
-CREATE FUNCTION test(int) RETURNS int
-    AS '<replaceable>filename</replaceable>', 'test_1arg'
-    LANGUAGE C;
-CREATE FUNCTION test(int, int) RETURNS int
-    AS '<replaceable>filename</replaceable>', 'test_2arg'
-    LANGUAGE C;
-</programlisting>
-    The names of the C functions here reflect one of many possible conventions.
-   </para>
-  </sect1>
-
-  <sect1 id="xfunc-volatility">
-   <title>Function Volatility Categories</title>
-
-   <indexterm zone="xfunc-volatility">
-    <primary>volatility</primary>
-    <secondary>functions</secondary>
-   </indexterm>
-   <indexterm zone="xfunc-volatility">
-    <primary>VOLATILE</primary>
-   </indexterm>
-   <indexterm zone="xfunc-volatility">
-    <primary>STABLE</primary>
-   </indexterm>
-   <indexterm zone="xfunc-volatility">
-    <primary>IMMUTABLE</primary>
-   </indexterm>
-
-   <para>
-    Every function has a <firstterm>volatility</firstterm> classification, with
-    the possibilities being <literal>VOLATILE</literal>, <literal>STABLE</literal>, or
-    <literal>IMMUTABLE</literal>.  <literal>VOLATILE</literal> is the default if the
-    <xref linkend="sql-createfunction"/>
-    command does not specify a category.  The volatility category is a
-    promise to the optimizer about the behavior of the function:
-
-   <itemizedlist>
-    <listitem>
-     <para>
-      A <literal>VOLATILE</literal> function can do anything, including modifying
-      the database.  It can return different results on successive calls with
-      the same arguments.  The optimizer makes no assumptions about the
-      behavior of such functions.  A query using a volatile function will
-      re-evaluate the function at every row where its value is needed.
-     </para>
-    </listitem>
-    <listitem>
-     <para>
-      A <literal>STABLE</literal> function cannot modify the database and is
-      guaranteed to return the same results given the same arguments
-      for all rows within a single statement. This category allows the
-      optimizer to optimize multiple calls of the function to a single
-      call. In particular, it is safe to use an expression containing
-      such a function in an index scan condition. (Since an index scan
-      will evaluate the comparison value only once, not once at each
-      row, it is not valid to use a <literal>VOLATILE</literal> function in an
-      index scan condition.)
-     </para>
-    </listitem>
-    <listitem>
-     <para>
-      An <literal>IMMUTABLE</literal> function cannot modify the database and is
-      guaranteed to return the same results given the same arguments forever.
-      This category allows the optimizer to pre-evaluate the function when
-      a query calls it with constant arguments.  For example, a query like
-      <literal>SELECT ... WHERE x = 2 + 2</literal> can be simplified on sight to
-      <literal>SELECT ... WHERE x = 4</literal>, because the function underlying
-      the integer addition operator is marked <literal>IMMUTABLE</literal>.
-     </para>
-    </listitem>
-   </itemizedlist>
-   </para>
-
-   <para>
-    For best optimization results, you should label your functions with the
-    strictest volatility category that is valid for them.
-   </para>
-
-   <para>
-    Any function with side-effects <emphasis>must</emphasis> be labeled
-    <literal>VOLATILE</literal>, so that calls to it cannot be optimized away.
-    Even a function with no side-effects needs to be labeled
-    <literal>VOLATILE</literal> if its value can change within a single query;
-    some examples are <literal>random()</literal>, <literal>currval()</literal>,
-    <literal>timeofday()</literal>.
-   </para>
-
-   <para>
-    Another important example is that the <function>current_timestamp</function>
-    family of functions qualify as <literal>STABLE</literal>, since their values do
-    not change within a transaction.
-   </para>
-
-   <para>
-    There is relatively little difference between <literal>STABLE</literal> and
-    <literal>IMMUTABLE</literal> categories when considering simple interactive
-    queries that are planned and immediately executed: it doesn't matter
-    a lot whether a function is executed once during planning or once during
-    query execution startup.  But there is a big difference if the plan is
-    saved and reused later.  Labeling a function <literal>IMMUTABLE</literal> when
-    it really isn't might allow it to be prematurely folded to a constant during
-    planning, resulting in a stale value being re-used during subsequent uses
-    of the plan.  This is a hazard when using prepared statements or when
-    using function languages that cache plans (such as
-    <application>PL/pgSQL</application>).
-   </para>
-
-   <para>
-    For functions written in SQL or in any of the standard procedural
-    languages, there is a second important property determined by the
-    volatility category, namely the visibility of any data changes that have
-    been made by the SQL command that is calling the function.  A
-    <literal>VOLATILE</literal> function will see such changes, a <literal>STABLE</literal>
-    or <literal>IMMUTABLE</literal> function will not.  This behavior is implemented
-    using the snapshotting behavior of MVCC (see <xref linkend="mvcc"/>):
-    <literal>STABLE</literal> and <literal>IMMUTABLE</literal> functions use a snapshot
-    established as of the start of the calling query, whereas
-    <literal>VOLATILE</literal> functions obtain a fresh snapshot at the start of
-    each query they execute.
-   </para>
-
-   <note>
-    <para>
-     Functions written in C can manage snapshots however they want, but it's
-     usually a good idea to make C functions work this way too.
-    </para>
-   </note>
-
-   <para>
-    Because of this snapshotting behavior,
-    a function containing only <command>SELECT</command> commands can safely be
-    marked <literal>STABLE</literal>, even if it selects from tables that might be
-    undergoing modifications by concurrent queries.
-    <productname>PostgreSQL</productname> will execute all commands of a
-    <literal>STABLE</literal> function using the snapshot established for the
-    calling query, and so it will see a fixed view of the database throughout
-    that query.
-   </para>
-
-   <para>
-    The same snapshotting behavior is used for <command>SELECT</command> commands
-    within <literal>IMMUTABLE</literal> functions.  It is generally unwise to select
-    from database tables within an <literal>IMMUTABLE</literal> function at all,
-    since the immutability will be broken if the table contents ever change.
-    However, <productname>PostgreSQL</productname> does not enforce that you
-    do not do that.
-   </para>
-
-   <para>
-    A common error is to label a function <literal>IMMUTABLE</literal> when its
-    results depend on a configuration parameter.  For example, a function
-    that manipulates timestamps might well have results that depend on the
-    <xref linkend="guc-timezone"/> setting.  For safety, such functions should
-    be labeled <literal>STABLE</literal> instead.
-   </para>
-
-   <note>
-    <para>
-     <productname>PostgreSQL</productname> requires that <literal>STABLE</literal>
-     and <literal>IMMUTABLE</literal> functions contain no SQL commands other
-     than <command>SELECT</command> to prevent data modification.
-     (This is not a completely bulletproof test, since such functions could
-     still call <literal>VOLATILE</literal> functions that modify the database.
-     If you do that, you will find that the <literal>STABLE</literal> or
-     <literal>IMMUTABLE</literal> function does not notice the database changes
-     applied by the called function, since they are hidden from its snapshot.)
-    </para>
-   </note>
-  </sect1>
-
-  <sect1 id="xfunc-pl">
-   <title>Procedural Language Functions</title>
-
-   <para>
-    <productname>PostgreSQL</productname> allows user-defined functions
-    to be written in other languages besides SQL and C.  These other
-    languages are generically called <firstterm>procedural
-    languages</firstterm> (<acronym>PL</acronym>s).
-    Procedural languages aren't built into the
-    <productname>PostgreSQL</productname> server; they are offered
-    by loadable modules.
-    See <xref linkend="xplang"/> and following chapters for more
-    information.
-   </para>
-  </sect1>
-
-  <sect1 id="xfunc-internal">
-   <title>Internal Functions</title>
-
-   <indexterm zone="xfunc-internal"><primary>function</primary><secondary>internal</secondary></indexterm>
-
-   <para>
-    Internal functions are functions written in C that have been statically
-    linked into the <productname>PostgreSQL</productname> server.
-    The <quote>body</quote> of the function definition
-    specifies the C-language name of the function, which need not be the
-    same as the name being declared for SQL use.
-    (For reasons of backward compatibility, an empty body
-    is accepted as meaning that the C-language function name is the
-    same as the SQL name.)
-   </para>
-
-   <para>
-    Normally, all internal functions present in the
-    server are declared during the initialization of the database cluster
-    (see <xref linkend="creating-cluster"/>),
-    but a user could use <command>CREATE FUNCTION</command>
-    to create additional alias names for an internal function.
-    Internal functions are declared in <command>CREATE FUNCTION</command>
-    with language name <literal>internal</literal>.  For instance, to
-    create an alias for the <function>sqrt</function> function:
-<programlisting>
-CREATE FUNCTION square_root(double precision) RETURNS double precision
-    AS 'dsqrt'
-    LANGUAGE internal
-    STRICT;
-</programlisting>
-    (Most internal functions expect to be declared <quote>strict</quote>.)
-   </para>
-
-   <note>
-    <para>
-     Not all <quote>predefined</quote> functions are
-     <quote>internal</quote> in the above sense.  Some predefined
-     functions are written in SQL.
-    </para>
-   </note>
-  </sect1>
-
   <sect1 id="xfunc-c">
    <title>C-Language Functions</title>
 
diff --git a/doc/src/sgml/xoper.sgml b/doc/src/sgml/xoper.sgml
index 2f5560ac50..2c68b1f747 100644
--- a/doc/src/sgml/xoper.sgml
+++ b/doc/src/sgml/xoper.sgml
@@ -1,80 +1,5 @@
 <!-- doc/src/sgml/xoper.sgml -->
 
- <sect1 id="xoper">
-  <title>User-defined Operators</title>
-
-  <indexterm zone="xoper">
-   <primary>operator</primary>
-   <secondary>user-defined</secondary>
-  </indexterm>
-
-  <para>
-   Every operator is <quote>syntactic sugar</quote> for a call to an
-   underlying function that does the real work; so you must
-   first create the underlying function before you can create
-   the operator.  However, an operator is <emphasis>not merely</emphasis>
-   syntactic sugar, because it carries additional information
-   that helps the query planner optimize queries that use the
-   operator.  The next section will be devoted to explaining
-   that additional information.
-  </para>
-
-  <para>
-   <productname>PostgreSQL</productname> supports left unary, right
-   unary, and binary operators.  Operators can be
-   overloaded;<indexterm><primary>overloading</primary><secondary>operators</secondary></indexterm>
-   that is, the same operator name can be used for different operators
-   that have different numbers and types of operands.  When a query is
-   executed, the system determines the operator to call from the
-   number and types of the provided operands.
-  </para>
-
-  <para>
-   Here is an example of creating an operator for adding two complex
-   numbers.  We assume we've already created the definition of type
-   <type>complex</type> (see <xref linkend="xtypes"/>).  First we need a
-   function that does the work, then we can define the operator:
-
-<programlisting>
-CREATE FUNCTION complex_add(complex, complex)
-    RETURNS complex
-    AS '<replaceable>filename</replaceable>', 'complex_add'
-    LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR + (
-    leftarg = complex,
-    rightarg = complex,
-    function = complex_add,
-    commutator = +
-);
-</programlisting>
-  </para>
-
-  <para>
-   Now we could execute a query like this:
-
-<screen>
-SELECT (a + b) AS c FROM test_complex;
-
-        c
------------------
- (5.2,6.05)
- (133.42,144.95)
-</screen>
-  </para>
-
-  <para>
-   We've shown how to create a binary operator here.  To create unary
-   operators, just omit one of <literal>leftarg</literal> (for left unary) or
-   <literal>rightarg</literal> (for right unary).  The <literal>function</literal>
-   clause and the argument clauses are the only required items in
-   <command>CREATE OPERATOR</command>.  The <literal>commutator</literal>
-   clause shown in the example is an optional hint to the query
-   optimizer.  Further details about <literal>commutator</literal> and other
-   optimizer hints appear in the next section.
-  </para>
- </sect1>
-
   <sect1 id="xoper-optimization">
    <title>Operator Optimization Information</title>
 