Commit 60c90c16 authored by Tom Lane's avatar Tom Lane

Doc: fix "Unresolved ID reference" warnings, clean up man page cross-refs.

Use xreflabel attributes instead of endterm attributes to control the
appearance of links to subsections of SQL command reference pages.
This is simpler, it matches what we do elsewhere (e.g. for GUC variables),
and it doesn't draw "Unresolved ID reference" warnings from the PDF
toolchain.

Fix some places where the text was absolutely dependent on an <xref>
rendering exactly so, by using a <link> around the required text
instead.  At least one of those spots had already been turned into
bad grammar by subsequent changes, and the whole idea is just too
fragile for my taste.  <xref> does NOT have fixed output, don't write
as if it does.

Consistently include a page-level link in cross-man-page references,
because otherwise they are useless/nonsensical in man-page output.
Likewise, be consistent about mentioning "below" or "above" in same-page
references; we were doing that in about 90% of the cases, but now it's
100%.

Also get rid of another nonfunctional-in-PDF idea, of making
cross-references to functions by sticking ID tags on <row> constructs.
We can put the IDs on <indexterm>s instead --- which is probably not any
more sensible in abstract terms, but it works where the other doesn't.
(There is talk of attaching cross-reference IDs to most or all of
the docs' function descriptions, but for now I just fixed the two
that exist.)

Discussion: https://postgr.es/m/14480.1589154358@sss.pgh.pa.us
parent 624686ab
......@@ -7301,8 +7301,7 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
These settings control the behavior of the <firstterm>autovacuum</firstterm>
feature. Refer to <xref linkend="autovacuum"/> for more information.
Note that many of these settings can be overridden on a per-table
basis; see <xref linkend="sql-createtable-storage-parameters"
endterm="sql-createtable-storage-parameters-title"/>.
basis; see <xref linkend="sql-createtable-storage-parameters"/>.
</para>
<variablelist>
......
......@@ -4355,9 +4355,9 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
</para></entry>
</row>
<row id="function-encode">
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<indexterm id="function-encode">
<primary>encode</primary>
</indexterm>
<function>encode</function> ( <parameter>bytes</parameter> <type>bytea</type>,
......@@ -4377,9 +4377,9 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
</para></entry>
</row>
<row id="function-decode">
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<indexterm id="function-decode">
<primary>decode</primary>
</indexterm>
<function>decode</function> ( <parameter>string</parameter> <type>text</type>,
......
......@@ -98,8 +98,7 @@ CREATE INDEX test1_id_index ON test1 (id);
In production environments this is often unacceptable.
It is possible to allow writes to occur in parallel with index
creation, but there are several caveats to be aware of &mdash;
for more information see <xref linkend="sql-createindex-concurrently"
endterm="sql-createindex-concurrently-title"/>.
for more information see <xref linkend="sql-createindex-concurrently"/>.
</para>
<para>
......
......@@ -827,8 +827,7 @@ analyze threshold = analyze base threshold + analyze scale factor * number of tu
The default thresholds and scale factors are taken from
<filename>postgresql.conf</filename>, but it is possible to override them
(and many other autovacuum control parameters) on a per-table basis; see
<xref linkend="sql-createtable-storage-parameters"
endterm="sql-createtable-storage-parameters-title"/> for more information.
<xref linkend="sql-createtable-storage-parameters"/> for more information.
If a setting has been changed via a table's storage parameters, that value
is used when processing that table; otherwise the global settings are
used. See <xref linkend="runtime-config-autovacuum"/> for more details on
......
......@@ -110,7 +110,7 @@ SELECT random();
<title>The <literal>FROM</literal> Clause</title>
<para>
The <xref linkend="sql-from" endterm="sql-from-title"/> derives a
The <link linkend="sql-from"><literal>FROM</literal></link> clause derives a
table from one or more other tables given in a comma-separated
table reference list.
<synopsis>
......@@ -907,8 +907,8 @@ WHERE pname IS NULL;
</indexterm>
<para>
The syntax of the <xref linkend="sql-where"
endterm="sql-where-title"/> is
The syntax of the <link linkend="sql-where"><literal>WHERE</literal></link>
clause is
<synopsis>
WHERE <replaceable>search_condition</replaceable>
</synopsis>
......@@ -1014,7 +1014,7 @@ SELECT <replaceable>select_list</replaceable>
</synopsis>
<para>
The <xref linkend="sql-groupby" endterm="sql-groupby-title"/> is
The <link linkend="sql-groupby"><literal>GROUP BY</literal></link> clause is
used to group together those rows in a table that have the same
values in all the columns listed. The order in which the columns
are listed does not matter. The effect is to combine each set
......
......@@ -93,16 +93,15 @@ ALTER COLLATION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_sche
<listitem>
<para>
Update the collation's version.
See <xref linkend="sql-altercollation-notes"
endterm="sql-altercollation-notes-title"/> below.
See <xref linkend="sql-altercollation-notes"/> below.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="sql-altercollation-notes">
<title id="sql-altercollation-notes-title">Notes</title>
<refsect1 id="sql-altercollation-notes" xreflabel="Notes">
<title>Notes</title>
<para>
When using collations provided by the ICU library, the ICU-specific version
......
......@@ -405,8 +405,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
database will not assume that the constraint holds for all rows in
the table, until it is validated by using the <literal>VALIDATE
CONSTRAINT</literal> option.
See <xref linkend="sql-altertable-notes"
endterm="sql-altertable-notes-title"/> below for more information
See <xref linkend="sql-altertable-notes"/> below for more information
about using the <literal>NOT VALID</literal> option.
</para>
......@@ -504,9 +503,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
previously created as <literal>NOT VALID</literal>, by scanning the
table to ensure there are no rows for which the constraint is not
satisfied. Nothing happens if the constraint is already marked valid.
(See <xref linkend="sql-altertable-notes"
endterm="sql-altertable-notes-title"/> below for an explanation of the
usefulness of this command.)
(See <xref linkend="sql-altertable-notes"/> below for an explanation
of the usefulness of this command.)
</para>
</listitem>
</varlistentry>
......@@ -708,8 +706,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
<listitem>
<para>
This form changes one or more storage parameters for the table. See
<xref linkend="sql-createtable-storage-parameters"
endterm="sql-createtable-storage-parameters-title"/>
<xref linkend="sql-createtable-storage-parameters"/> in the
<xref linkend="sql-createtable"/> documentation
for details on the available parameters. Note that the table contents
will not be modified immediately by this command; depending on the
parameter you might need to rewrite the table to get the desired effects.
......@@ -1210,8 +1208,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
</variablelist>
</refsect1>
<refsect1 id="sql-altertable-notes">
<title id="sql-altertable-notes-title">Notes</title>
<refsect1 id="sql-altertable-notes" xreflabel="Notes">
<title>Notes</title>
<para>
The key word <literal>COLUMN</literal> is noise and can be omitted.
......
......@@ -434,8 +434,8 @@ SELECT col FROM tab ORDER BY col USING sortop LIMIT 1;
This option specifies whether the final function is a pure function
that does not modify its arguments. <literal>READ_ONLY</literal> indicates
it does not; the other two values indicate that it may change the
transition state value. See <xref linkend="sql-createaggregate-notes"
endterm="sql-createaggregate-notes-title"/> below for more detail. The
transition state value. See <xref linkend="sql-createaggregate-notes"/>
below for more detail. The
default is <literal>READ_ONLY</literal>, except for ordered-set aggregates,
for which the default is <literal>READ_WRITE</literal>.
</para>
......@@ -664,8 +664,8 @@ SELECT col FROM tab ORDER BY col USING sortop LIMIT 1;
</para>
</refsect1>
<refsect1 id="sql-createaggregate-notes">
<title id="sql-createaggregate-notes-title">Notes</title>
<refsect1 id="sql-createaggregate-notes" xreflabel="Notes">
<title>Notes</title>
<para>
In parameters that specify support function names, you can write
......
......@@ -126,8 +126,7 @@ CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] <replaceable class=
updates, or deletes on the table; whereas a standard index build
locks out writes (but not reads) on the table until it's done.
There are several caveats to be aware of when using this option
&mdash; see <xref linkend="sql-createindex-concurrently"
endterm="sql-createindex-concurrently-title"/>.
&mdash; see <xref linkend="sql-createindex-concurrently"/> below.
</para>
<para>
For temporary tables, <command>CREATE INDEX</command> is always
......@@ -337,7 +336,7 @@ CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] <replaceable class=
<listitem>
<para>
The name of an index-method-specific storage parameter. See
<xref linkend="sql-createindex-storage-parameters" endterm="sql-createindex-storage-parameters-title"/>
<xref linkend="sql-createindex-storage-parameters"/> below
for details.
</para>
</listitem>
......@@ -366,8 +365,8 @@ CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] <replaceable class=
</variablelist>
<refsect2 id="sql-createindex-storage-parameters">
<title id="sql-createindex-storage-parameters-title">Index Storage Parameters</title>
<refsect2 id="sql-createindex-storage-parameters" xreflabel="Index Storage Parameters">
<title>Index Storage Parameters</title>
<para>
The optional <literal>WITH</literal> clause specifies <firstterm>storage
......@@ -559,8 +558,8 @@ CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] <replaceable class=
</variablelist>
</refsect2>
<refsect2 id="sql-createindex-concurrently">
<title id="sql-createindex-concurrently-title">Building Indexes Concurrently</title>
<refsect2 id="sql-createindex-concurrently" xreflabel="Building Indexes Concurrently">
<title>Building Indexes Concurrently</title>
<indexterm zone="sql-createindex-concurrently">
<primary>index</primary>
......@@ -688,7 +687,7 @@ Indexes:
</para>
<para>
An <firstterm>operator class</firstterm> with its optional parameters
An <firstterm>operator class</firstterm> with optional parameters
can be specified for each column of an index.
The operator class identifies the operators to be
used by the index for that column. For example, a B-tree index on
......
......@@ -106,8 +106,9 @@ CREATE MATERIALIZED VIEW [ IF NOT EXISTS ] <replaceable>table_name</replaceable>
<listitem>
<para>
This clause specifies optional storage parameters for the new
materialized view; see <xref linkend="sql-createtable-storage-parameters"
endterm="sql-createtable-storage-parameters-title"/> for more
materialized view; see
<xref linkend="sql-createtable-storage-parameters"/> in the
<xref linkend="sql-createtable"/> documentation for more
information. All parameters supported for <literal>CREATE
TABLE</literal> are also supported for <literal>CREATE MATERIALIZED
VIEW</literal>.
......
......@@ -192,8 +192,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
can be written before <literal>TEMPORARY</literal> or <literal>TEMP</literal>.
This presently makes no difference in <productname>PostgreSQL</productname>
and is deprecated; see
<xref linkend="sql-createtable-compatibility"
endterm="sql-createtable-compatibility-title"/>.
<xref linkend="sql-createtable-compatibility"/> below.
</para>
</listitem>
</varlistentry>
......@@ -1201,8 +1200,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
<listitem>
<para>
This clause specifies optional storage parameters for a table or index;
see <xref linkend="sql-createtable-storage-parameters"
endterm="sql-createtable-storage-parameters-title"/> for more
see <xref linkend="sql-createtable-storage-parameters"/> below for more
information. For backward-compatibility the <literal>WITH</literal>
clause for a table can also include <literal>OIDS=FALSE</literal> to
specify that rows of the new table should not contain OIDs (object
......@@ -1302,8 +1300,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
</variablelist>
<refsect2 id="sql-createtable-storage-parameters">
<title id="sql-createtable-storage-parameters-title">Storage Parameters</title>
<refsect2 id="sql-createtable-storage-parameters" xreflabel="Storage Parameters">
<title>Storage Parameters</title>
<indexterm zone="sql-createtable-storage-parameters">
<primary>storage parameters</primary>
......@@ -2063,8 +2061,8 @@ CREATE TABLE cities_partdef
</programlisting></para>
</refsect1>
<refsect1 id="sql-createtable-compatibility">
<title id="sql-createtable-compatibility-title">Compatibility</title>
<refsect1 id="sql-createtable-compatibility" xreflabel="Compatibility">
<title>Compatibility</title>
<para>
The <command>CREATE TABLE</command> command conforms to the
......
......@@ -140,8 +140,8 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
<listitem>
<para>
This clause specifies optional storage parameters for the new table;
see <xref linkend="sql-createtable-storage-parameters"
endterm="sql-createtable-storage-parameters-title"/> for more
see <xref linkend="sql-createtable-storage-parameters"/> in the
<xref linkend="sql-createtable"/> documentation for more
information. For backward-compatibility the <literal>WITH</literal>
clause for a table can also include <literal>OIDS=FALSE</literal> to
specify that rows of the new table should contain no OIDs (object
......
......@@ -99,8 +99,8 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI
<literal>NO SCROLL</literal> specifies that the cursor cannot be
used to retrieve rows in a nonsequential fashion. The default is to
allow scrolling in some cases; this is not the same as specifying
<literal>SCROLL</literal>. See <xref linkend="sql-declare-notes"
endterm="sql-declare-notes-title"/> for details.
<literal>SCROLL</literal>. See <xref linkend="sql-declare-notes"/>
below for details.
</para>
</listitem>
</varlistentry>
......@@ -139,8 +139,8 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI
</para>
</refsect1>
<refsect1 id="sql-declare-notes">
<title id="sql-declare-notes-title">Notes</title>
<refsect1 id="sql-declare-notes" xreflabel="Notes">
<title>Notes</title>
<para>
Normal cursors return data in text format, the same as a
......
......@@ -122,8 +122,8 @@ DELETE FROM [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ *
<para>
A table expression allowing columns from other tables to appear
in the <literal>WHERE</literal> condition. This uses the same
syntax as the <xref linkend="sql-from" endterm="sql-from-title"/>
of a <command>SELECT</command> statement; for example, an alias
syntax as the <link linkend="sql-from"><literal>FROM</literal></link>
clause of a <command>SELECT</command> statement; for example, an alias
for the table name can be specified. Do not repeat the target
table as a <replaceable class="parameter">from_item</replaceable>
unless you wish to set up a self-join (in which case it must appear
......
......@@ -94,9 +94,8 @@ EXECUTE <replaceable class="parameter">name</replaceable> [ ( <replaceable class
<refsect1>
<title>Examples</title>
<para>
Examples are given in the <xref linkend="sql-prepare-examples"
endterm="sql-prepare-examples-title"/> section of the <xref
linkend="sql-prepare"/> documentation.
Examples are given in <xref linkend="sql-prepare-examples"/>
in the <xref linkend="sql-prepare"/> documentation.
</para>
</refsect1>
......
......@@ -77,8 +77,7 @@ INSERT INTO <replaceable class="parameter">table_name</replaceable> [ AS <replac
<para>
<literal>ON CONFLICT</literal> can be used to specify an alternative
action to raising a unique constraint or exclusion constraint
violation error. (See <xref linkend="sql-on-conflict"
endterm="sql-on-conflict-title"/> below.)
violation error. (See <xref linkend="sql-on-conflict"/> below.)
</para>
<para>
......@@ -128,8 +127,8 @@ INSERT INTO <replaceable class="parameter">table_name</replaceable> [ AS <replac
<refsect1>
<title>Parameters</title>
<refsect2 id="sql-inserting-params">
<title id="sql-inserting-params-title">Inserting</title>
<refsect2>
<title>Inserting</title>
<para>
This section covers parameters that may be used when only
......@@ -315,8 +314,8 @@ INSERT INTO <replaceable class="parameter">table_name</replaceable> [ AS <replac
</variablelist>
</refsect2>
<refsect2 id="sql-on-conflict">
<title id="sql-on-conflict-title"><literal>ON CONFLICT</literal> Clause</title>
<refsect2 id="sql-on-conflict" xreflabel="ON CONFLICT Clause">
<title><literal>ON CONFLICT</literal> Clause</title>
<indexterm zone="sql-insert">
<primary>UPSERT</primary>
</indexterm>
......
......@@ -202,9 +202,8 @@ LOCK [ TABLE ] [ ONLY ] <replaceable class="parameter">name</replaceable> [ * ]
<command>LOCK TABLE</command> is concerned, differing only in the rules
about which modes conflict with which. For information on how to
acquire an actual row-level lock, see <xref linkend="locking-rows"/>
and the <xref linkend="sql-for-update-share"
endterm="sql-for-update-share-title"/> in the <command>SELECT</command>
reference documentation.
and <xref linkend="sql-for-update-share"/>
in the <xref linkend="sql-select"/> documentation.
</para>
</refsect1>
......
......@@ -387,12 +387,12 @@ PostgreSQL documentation
selected by writing multiple <option>-n</option> switches. The
<replaceable class="parameter">pattern</replaceable> parameter is
interpreted as a pattern according to the same rules used by
<application>psql</application>'s <literal>\d</literal> commands (see <xref
linkend="app-psql-patterns" endterm="app-psql-patterns-title"/>),
<application>psql</application>'s <literal>\d</literal> commands
(see <xref linkend="app-psql-patterns"/> below),
so multiple schemas can also be selected by writing wildcard characters
in the pattern. When using wildcards, be careful to quote the pattern
if needed to prevent the shell from expanding the wildcards; see
<xref linkend="pg-dump-examples" endterm="pg-dump-examples-title"/>.
<xref linkend="pg-dump-examples"/> below.
</para>
<note>
......@@ -524,12 +524,12 @@ PostgreSQL documentation
can be selected by writing multiple <option>-t</option> switches. The
<replaceable class="parameter">pattern</replaceable> parameter is
interpreted as a pattern according to the same rules used by
<application>psql</application>'s <literal>\d</literal> commands (see <xref
linkend="app-psql-patterns" endterm="app-psql-patterns-title"/>),
<application>psql</application>'s <literal>\d</literal> commands
(see <xref linkend="app-psql-patterns"/> below),
so multiple tables can also be selected by writing wildcard characters
in the pattern. When using wildcards, be careful to quote the pattern
if needed to prevent the shell from expanding the wildcards; see
<xref linkend="pg-dump-examples" endterm="pg-dump-examples-title"/>.
<xref linkend="pg-dump-examples"/> below.
</para>
<para>
......@@ -777,12 +777,12 @@ PostgreSQL documentation
<option>--include-foreign-data</option> switches.
Also, the <replaceable class="parameter">foreignserver</replaceable> parameter is
interpreted as a pattern according to the same rules used by
<application>psql</application>'s <literal>\d</literal> commands (see <xref
linkend="app-psql-patterns" endterm="app-psql-patterns-title"/>),
<application>psql</application>'s <literal>\d</literal> commands
(see <xref linkend="app-psql-patterns"/> below),
so multiple foreign servers can also be selected by writing wildcard characters
in the pattern. When using wildcards, be careful to quote the pattern
if needed to prevent the shell from expanding the wildcards; see
<xref linkend="pg-dump-examples" endterm="pg-dump-examples-title"/>.
<xref linkend="pg-dump-examples"/> below.
The only exception is that an empty pattern is disallowed.
</para>
......@@ -1367,8 +1367,8 @@ CREATE DATABASE foo WITH TEMPLATE template0;
</para>
</refsect1>
<refsect1 id="pg-dump-examples">
<title id="pg-dump-examples-title">Examples</title>
<refsect1 id="pg-dump-examples" xreflabel="Examples">
<title>Examples</title>
<para>
To dump a database called <literal>mydb</literal> into a SQL-script file:
......@@ -1477,8 +1477,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
<para>
To specify an upper-case or mixed-case name in <option>-t</option> and related
switches, you need to double-quote the name; else it will be folded to
lower case (see <xref
linkend="app-psql-patterns" endterm="app-psql-patterns-title"/>). But
lower case (see <xref linkend="app-psql-patterns"/> below). But
double quotes are special to the shell, so in turn they must be quoted.
Thus, to dump a single table with a mixed-case name, you need something
like
......
......@@ -310,8 +310,7 @@ PostgreSQL documentation
<replaceable class="parameter">pattern</replaceable> parameter is
interpreted as a pattern according to the same rules used by
<application>psql</application>'s <literal>\d</literal>
commands (see <xref
linkend="app-psql-patterns" endterm="app-psql-patterns-title"/>),
commands (see <xref linkend="app-psql-patterns"/> below),
so multiple databases can also be excluded by writing wildcard
characters in the pattern. When using wildcards, be careful to
quote the pattern if needed to prevent shell wildcard expansion.
......
......@@ -530,8 +530,7 @@ PostgreSQL documentation
<para>
The following options only apply to the single-user mode
(see <xref linkend="app-postgres-single-user"
endterm="app-postgres-single-user-title"/>).
(see <xref linkend="app-postgres-single-user"/> below).
</para>
<variablelist>
......@@ -753,8 +752,8 @@ PostgreSQL documentation
</para>
</refsect1>
<refsect1 id="app-postgres-single-user">
<title id="app-postgres-single-user-title">Single-User Mode</title>
<refsect1 id="app-postgres-single-user" xreflabel="Single-User Mode">
<title>Single-User Mode</title>
<para>
To start a single-user mode server, use a command like
......
......@@ -208,8 +208,8 @@ EXPLAIN EXECUTE <replaceable>name</replaceable>(<replaceable>parameter_values</r
</para>
</refsect1>
<refsect1 id="sql-prepare-examples">
<title id="sql-prepare-examples-title">Examples</title>
<refsect1 id="sql-prepare-examples" xreflabel="Examples">
<title>Examples</title>
<para>
Create a prepared statement for an <command>INSERT</command>
statement, and then execute it:
......
......@@ -809,7 +809,7 @@ testdb=&gt;
If an unquoted colon (<literal>:</literal>) followed by a
<application>psql</application> variable name appears within an argument, it is
replaced by the variable's value, as described in <xref
linkend="app-psql-interpolation" endterm="app-psql-interpolation-title"/>.
linkend="app-psql-interpolation"/> below.
The forms <literal>:'<replaceable>variable_name</replaceable>'</literal> and
<literal>:"<replaceable>variable_name</replaceable>"</literal> described there
work as well.
......@@ -1163,8 +1163,7 @@ testdb=&gt;
also shown. For foreign tables, the associated foreign
server is shown as well.
(<quote>Matching the pattern</quote> is defined in
<xref linkend="app-psql-patterns" endterm="app-psql-patterns-title"/>
below.)
<xref linkend="app-psql-patterns"/> below.)
</para>
<para>
......@@ -1946,9 +1945,8 @@ testdb=&gt;
<tip>
<para>
See under <xref linkend="app-psql-environment"
endterm="app-psql-environment-title"/> for how to configure and
customize your editor.
See <xref linkend="app-psql-environment"/>, below, for how to
configure and customize your editor.
</para>
</tip>
</listitem>
......@@ -2022,9 +2020,8 @@ Tue Oct 26 21:40:57 CEST 1999
<tip>
<para>
See under <xref linkend="app-psql-environment"
endterm="app-psql-environment-title"/> for how to configure and
customize your editor.
See <xref linkend="app-psql-environment"/>, below, for how to
configure and customize your editor.
</para>
</tip>
</listitem>
......@@ -2230,8 +2227,8 @@ CREATE INDEX
<listitem>
<para>
Sends the current query buffer to the server and stores the
query's output into <application>psql</application> variables (see <xref
linkend="app-psql-variables" endterm="app-psql-variables-title"/>).
query's output into <application>psql</application> variables
(see <xref linkend="app-psql-variables"/> below).
The query to be executed must return exactly one row. Each column of
the row is stored into a separate variable, named the same as the
column. For example:
......@@ -3078,8 +3075,7 @@ lo_import 152801
<para>
Illustrations of how these different formats look can be seen in
the <xref linkend="app-psql-examples"
endterm="app-psql-examples-title"/> section.
<xref linkend="app-psql-examples"/>, below.
</para>
<tip>
......@@ -3163,9 +3159,7 @@ lo_import 152801
<para>
Valid variable names can contain letters, digits, and
underscores. See the section <xref
linkend="app-psql-variables"
endterm="app-psql-variables-title"/> below for details.
underscores. See <xref linkend="app-psql-variables"/> below for details.
Variable names are case-sensitive.
</para>
......@@ -3173,8 +3167,7 @@ lo_import 152801
Certain variables are special, in that they
control <application>psql</application>'s behavior or are
automatically set to reflect connection state. These variables are
documented in <xref linkend="app-psql-variables"
endterm="app-psql-variables-title"/>, below.
documented in <xref linkend="app-psql-variables"/>, below.
</para>
<note>
......@@ -3318,8 +3311,7 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
Most variables that control <application>psql</application>'s behavior
cannot be unset; instead, an <literal>\unset</literal> command is interpreted
as setting them to their default values.
See <xref linkend="app-psql-variables"
endterm="app-psql-variables-title"/>, below.
See <xref linkend="app-psql-variables"/> below.
</para>
</listitem>
</varlistentry>
......@@ -3489,8 +3481,8 @@ select 1\; select 2\; select 3;
</variablelist>
</para>
<refsect3 id="app-psql-patterns">
<title id="app-psql-patterns-title">Patterns</title>
<refsect3 id="app-psql-patterns" xreflabel="Patterns">
<title>Patterns</title>
<indexterm>
<primary>patterns</primary>
......@@ -3582,8 +3574,8 @@ select 1\; select 2\; select 3;
<refsect2>
<title>Advanced Features</title>
<refsect3 id="app-psql-variables">
<title id="app-psql-variables-title">Variables</title>
<refsect3 id="app-psql-variables" xreflabel="Variables">
<title>Variables</title>
<para>
<application>psql</application> provides variable substitution
......@@ -3607,8 +3599,7 @@ testdb=&gt; <userinput>\echo :foo</userinput>
bar
</programlisting>
This works in both regular SQL commands and meta-commands; there is
more detail in <xref linkend="app-psql-interpolation"
endterm="app-psql-interpolation-title"/>, below.
more detail in <xref linkend="app-psql-interpolation"/>, below.
</para>
<para>
......@@ -4016,8 +4007,7 @@ bar
<para>
These specify what the prompts <application>psql</application>
issues should look like. See <xref
linkend="app-psql-prompting"
endterm="app-psql-prompting-title"/> below.
linkend="app-psql-prompting"/> below.
</para>
</listitem>
</varlistentry>
......@@ -4151,8 +4141,8 @@ bar
</refsect3>
<refsect3 id="app-psql-interpolation">
<title id="app-psql-interpolation-title"><acronym>SQL</acronym> Interpolation</title>
<refsect3 id="app-psql-interpolation" xreflabel="SQL Interpolation">
<title><acronym>SQL</acronym> Interpolation</title>
<para>
A key feature of <application>psql</application>
......@@ -4236,8 +4226,8 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
</refsect3>
<refsect3 id="app-psql-prompting">
<title id="app-psql-prompting-title">Prompting</title>
<refsect3 id="app-psql-prompting" xreflabel="Prompting">
<title>Prompting</title>
<para>
The prompts <application>psql</application> issues can be customized
......@@ -4393,9 +4383,8 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
<listitem>
<para>
The value of the <application>psql</application> variable
<replaceable class="parameter">name</replaceable>. See the
section <xref linkend="app-psql-variables"
endterm="app-psql-variables-title"/> for details.
<replaceable class="parameter">name</replaceable>. See
<xref linkend="app-psql-variables"/>, above, for details.
</para>
</listitem>
</varlistentry>
......@@ -4492,8 +4481,8 @@ $endif
</refsect1>
<refsect1 id="app-psql-environment">
<title id="app-psql-environment-title">Environment</title>
<refsect1 id="app-psql-environment" xreflabel="Environment">
<title>Environment</title>
<variablelist>
......@@ -4798,8 +4787,8 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
</refsect1>
<refsect1 id="app-psql-examples">
<title id="app-psql-examples-title">Examples</title>
<refsect1 id="app-psql-examples" xreflabel="Examples">
<title>Examples</title>
<para>
The first example shows how to spread a command over several lines of
......
......@@ -163,8 +163,7 @@ REINDEX [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] { IN
updates, or deletes on the table; whereas a standard index rebuild
locks out writes (but not reads) on the table until it's done.
There are several caveats to be aware of when using this option
&mdash; see <xref linkend="sql-reindex-concurrently"
endterm="sql-reindex-concurrently-title"/>.
&mdash; see <xref linkend="sql-reindex-concurrently"/> below.
</para>
<para>
For temporary tables, <command>REINDEX</command> is always
......@@ -264,8 +263,8 @@ REINDEX [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] { IN
Each individual partition can be reindexed separately instead.
</para>
<refsect2 id="sql-reindex-concurrently">
<title id="sql-reindex-concurrently-title">Rebuilding Indexes Concurrently</title>
<refsect2 id="sql-reindex-concurrently" xreflabel="Rebuilding Indexes Concurrently">
<title>Rebuilding Indexes Concurrently</title>
<indexterm zone="sql-reindex-concurrently">
<primary>index</primary>
......
......@@ -95,7 +95,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
that is referenced more than once in <literal>FROM</literal> is
computed only once,
unless specified otherwise with <literal>NOT MATERIALIZED</literal>.
(See <xref linkend="sql-with" endterm="sql-with-title"/> below.)
(See <xref linkend="sql-with"/> below.)
</para>
</listitem>
......@@ -105,7 +105,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
(Each element in the <literal>FROM</literal> list is a real or
virtual table.) If more than one element is specified in the
<literal>FROM</literal> list, they are cross-joined together.
(See <xref linkend="sql-from" endterm="sql-from-title"/> below.)
(See <xref linkend="sql-from"/> below.)
</para>
</listitem>
......@@ -113,8 +113,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
<para>
If the <literal>WHERE</literal> clause is specified, all rows
that do not satisfy the condition are eliminated from the
output. (See <xref linkend="sql-where"
endterm="sql-where-title"/> below.)
output. (See <xref linkend="sql-where"/> below.)
</para>
</listitem>
......@@ -126,8 +125,8 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
values, and the results of aggregate functions are computed.
If the <literal>HAVING</literal> clause is present, it
eliminates groups that do not satisfy the given condition. (See
<xref linkend="sql-groupby" endterm="sql-groupby-title"/> and
<xref linkend="sql-having" endterm="sql-having-title"/> below.)
<xref linkend="sql-groupby"/> and
<xref linkend="sql-having"/> below.)
</para>
</listitem>
......@@ -135,9 +134,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
<para>
The actual output rows are computed using the
<command>SELECT</command> output expressions for each selected
row or row group. (See
<xref linkend="sql-select-list" endterm="sql-select-list-title"/>
below.)
row or row group. (See <xref linkend="sql-select-list"/> below.)
</para>
</listitem>
......@@ -146,8 +143,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
result. <literal>SELECT DISTINCT ON</literal> eliminates rows that
match on all the specified expressions. <literal>SELECT ALL</literal>
(the default) will return all candidate rows, including
duplicates. (See <xref linkend="sql-distinct"
endterm="sql-distinct-title"/> below.)
duplicates. (See <xref linkend="sql-distinct"/> below.)
</para>
</listitem>
......@@ -168,9 +164,8 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
eliminating duplicate rows. Notice that <literal>DISTINCT</literal> is
the default behavior here, even though <literal>ALL</literal> is
the default for <command>SELECT</command> itself. (See
<xref linkend="sql-union" endterm="sql-union-title"/>, <xref
linkend="sql-intersect" endterm="sql-intersect-title"/>, and
<xref linkend="sql-except" endterm="sql-except-title"/> below.)
<xref linkend="sql-union"/>, <xref linkend="sql-intersect"/>, and
<xref linkend="sql-except"/> below.)
</para>
</listitem>
......@@ -180,7 +175,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
returned rows are sorted in the specified order. If
<literal>ORDER BY</literal> is not given, the rows are returned
in whatever order the system finds fastest to produce. (See
<xref linkend="sql-orderby" endterm="sql-orderby-title"/> below.)
<xref linkend="sql-orderby"/> below.)
</para>
</listitem>
......@@ -189,7 +184,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
If the <literal>LIMIT</literal> (or <literal>FETCH FIRST</literal>) or <literal>OFFSET</literal>
clause is specified, the <command>SELECT</command> statement
only returns a subset of the result rows. (See <xref
linkend="sql-limit" endterm="sql-limit-title"/> below.)
linkend="sql-limit"/> below.)
</para>
</listitem>
......@@ -199,8 +194,8 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
or <literal>FOR KEY SHARE</literal>
is specified, the
<command>SELECT</command> statement locks the selected rows
against concurrent updates. (See <xref linkend="sql-for-update-share"
endterm="sql-for-update-share-title"/> below.)
against concurrent updates. (See <xref linkend="sql-for-update-share"/>
below.)
</para>
</listitem>
</orderedlist>
......@@ -219,8 +214,8 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
<refsect1>
<title>Parameters</title>
<refsect2 id="sql-with">
<title id="sql-with-title"><literal>WITH</literal> Clause</title>
<refsect2 id="sql-with" xreflabel="WITH Clause">
<title><literal>WITH</literal> Clause</title>
<para>
The <literal>WITH</literal> clause allows you to specify one or more
......@@ -336,8 +331,8 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
</para>
</refsect2>
<refsect2 id="sql-from">
<title id="sql-from-title"><literal>FROM</literal> Clause</title>
<refsect2 id="sql-from" xreflabel="FROM Clause">
<title><literal>FROM</literal> Clause</title>
<para>
The <literal>FROM</literal> clause specifies one or more source
......@@ -707,8 +702,8 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
</para>
</refsect2>
<refsect2 id="sql-where">
<title id="sql-where-title"><literal>WHERE</literal> Clause</title>
<refsect2 id="sql-where" xreflabel="WHERE Clause">
<title><literal>WHERE</literal> Clause</title>
<para>
The optional <literal>WHERE</literal> clause has the general form
......@@ -724,8 +719,8 @@ WHERE <replaceable class="parameter">condition</replaceable>
</para>
</refsect2>
<refsect2 id="sql-groupby">
<title id="sql-groupby-title"><literal>GROUP BY</literal> Clause</title>
<refsect2 id="sql-groupby" xreflabel="GROUP BY Clause">
<title><literal>GROUP BY</literal> Clause</title>
<para>
The optional <literal>GROUP BY</literal> clause has the general form
......@@ -798,8 +793,8 @@ GROUP BY <replaceable class="parameter">grouping_element</replaceable> [, ...]
</para>
</refsect2>
<refsect2 id="sql-having">
<title id="sql-having-title"><literal>HAVING</literal> Clause</title>
<refsect2 id="sql-having" xreflabel="HAVING Clause">
<title><literal>HAVING</literal> Clause</title>
<para>
The optional <literal>HAVING</literal> clause has the general form
......@@ -841,8 +836,8 @@ HAVING <replaceable class="parameter">condition</replaceable>
</para>
</refsect2>
<refsect2 id="sql-window">
<title id="sql-window-title"><literal>WINDOW</literal> Clause</title>
<refsect2 id="sql-window" xreflabel="WINDOW Clause">
<title><literal>WINDOW</literal> Clause</title>
<para>
The optional <literal>WINDOW</literal> clause has the general form
......@@ -874,8 +869,8 @@ WINDOW <replaceable class="parameter">window_name</replaceable> AS ( <replaceabl
<para>
The elements of the <literal>PARTITION BY</literal> list are interpreted in
much the same fashion as elements of a
<xref linkend="sql-groupby" endterm="sql-groupby-title"/>, except that
much the same fashion as elements of a <link
linkend="sql-groupby"><literal>GROUP BY</literal></link> clause, except that
they are always simple expressions and never the name or number of an
output column.
Another difference is that these expressions can contain aggregate
......@@ -886,8 +881,8 @@ WINDOW <replaceable class="parameter">window_name</replaceable> AS ( <replaceabl
<para>
Similarly, the elements of the <literal>ORDER BY</literal> list are interpreted
in much the same fashion as elements of an
<xref linkend="sql-orderby" endterm="sql-orderby-title"/>, except that
in much the same fashion as elements of a statement-level <link
linkend="sql-orderby"><literal>ORDER BY</literal></link> clause, except that
the expressions are always taken as simple expressions and never the name
or number of an output column.
</para>
......@@ -1011,8 +1006,9 @@ EXCLUDE NO OTHERS
<para>
The purpose of a <literal>WINDOW</literal> clause is to specify the
behavior of <firstterm>window functions</firstterm> appearing in the query's
<xref linkend="sql-select-list" endterm="sql-select-list-title"/> or
<xref linkend="sql-orderby" endterm="sql-orderby-title"/>. These functions
<link linkend="sql-select-list"><command>SELECT</command> list</link> or
<link linkend="sql-orderby"><literal>ORDER BY</literal></link> clause.
These functions
can reference the <literal>WINDOW</literal> clause entries by name
in their <literal>OVER</literal> clauses. A <literal>WINDOW</literal> clause
entry does not have to be referenced anywhere, however; if it is not
......@@ -1038,8 +1034,8 @@ EXCLUDE NO OTHERS
</para>
</refsect2>
<refsect2 id="sql-select-list">
<title id="sql-select-list-title"><command>SELECT</command> List</title>
<refsect2 id="sql-select-list" xreflabel="SELECT List">
<title><command>SELECT</command> List</title>
<para>
The <command>SELECT</command> list (between the key words
......@@ -1119,8 +1115,8 @@ EXCLUDE NO OTHERS
</note>
</refsect2>
<refsect2 id="sql-distinct">
<title id="sql-distinct-title"><literal>DISTINCT</literal> Clause</title>
<refsect2 id="sql-distinct" xreflabel="DISTINCT Clause">
<title><literal>DISTINCT</literal> Clause</title>
<para>
If <literal>SELECT DISTINCT</literal> is specified, all duplicate rows are
......@@ -1164,8 +1160,8 @@ SELECT DISTINCT ON (location) location, time, report
</para>
</refsect2>
<refsect2 id="sql-union">
<title id="sql-union-title"><literal>UNION</literal> Clause</title>
<refsect2 id="sql-union" xreflabel="UNION Clause">
<title><literal>UNION</literal> Clause</title>
<para>
The <literal>UNION</literal> clause has this general form:
......@@ -1217,8 +1213,8 @@ SELECT DISTINCT ON (location) location, time, report
</para>
</refsect2>
<refsect2 id="sql-intersect">
<title id="sql-intersect-title"><literal>INTERSECT</literal> Clause</title>
<refsect2 id="sql-intersect" xreflabel="INTERSECT Clause">
<title><literal>INTERSECT</literal> Clause</title>
<para>
The <literal>INTERSECT</literal> clause has this general form:
......@@ -1265,8 +1261,8 @@ SELECT DISTINCT ON (location) location, time, report
</para>
</refsect2>
<refsect2 id="sql-except">
<title id="sql-except-title"><literal>EXCEPT</literal> Clause</title>
<refsect2 id="sql-except" xreflabel="EXCEPT Clause">
<title><literal>EXCEPT</literal> Clause</title>
<para>
The <literal>EXCEPT</literal> clause has this general form:
......@@ -1309,8 +1305,8 @@ SELECT DISTINCT ON (location) location, time, report
</para>
</refsect2>
<refsect2 id="sql-orderby">
<title id="sql-orderby-title"><literal>ORDER BY</literal> Clause</title>
<refsect2 id="sql-orderby" xreflabel="ORDER BY Clause">
<title><literal>ORDER BY</literal> Clause</title>
<para>
The optional <literal>ORDER BY</literal> clause has this general form:
......@@ -1407,8 +1403,8 @@ SELECT name FROM distributors ORDER BY code;
</para>
</refsect2>
<refsect2 id="sql-limit">
<title id="sql-limit-title"><literal>LIMIT</literal> Clause</title>
<refsect2 id="sql-limit" xreflabel="LIMIT Clause">
<title><literal>LIMIT</literal> Clause</title>
<para>
The <literal>LIMIT</literal> clause consists of two independent
......@@ -1492,8 +1488,8 @@ FETCH { FIRST | NEXT } [ <replaceable class="parameter">count</replaceable> ] {
</para>
</refsect2>
<refsect2 id="sql-for-update-share">
<title id="sql-for-update-share-title">The Locking Clause</title>
<refsect2 id="sql-for-update-share" xreflabel="The Locking Clause">
<title>The Locking Clause</title>
<para>
<literal>FOR UPDATE</literal>, <literal>FOR NO KEY UPDATE</literal>, <literal>FOR SHARE</literal>
......@@ -2086,7 +2082,7 @@ SELECT distributors.* WHERE distributors.name = 'Westward';
used by <productname>MySQL</productname>. The SQL:2008 standard
has introduced the clauses <literal>OFFSET ... FETCH {FIRST|NEXT}
...</literal> for the same functionality, as shown above
in <xref linkend="sql-limit" endterm="sql-limit-title"/>. This
in <xref linkend="sql-limit"/>. This
syntax is also used by <productname>IBM DB2</productname>.
(Applications written for <productname>Oracle</productname>
frequently use a workaround involving the automatically
......
......@@ -172,8 +172,9 @@ UPDATE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [
<para>
A table expression allowing columns from other tables to appear in
the <literal>WHERE</literal> condition and update expressions. This
uses the same syntax as the <xref linkend="sql-from"
endterm="sql-from-title"/> of a <command>SELECT</command> statement;
uses the same syntax as the <link
linkend="sql-from"><literal>FROM</literal></link> clause of
a <command>SELECT</command> statement;
for example, an alias for the table name can be specified. Do not
repeat the target table as a <replaceable>from_item</replaceable>
unless you intend a self-join (in which case it must appear with
......
......@@ -85,7 +85,8 @@ VALUES ( <replaceable class="parameter">expression</replaceable> [, ...] ) [, ..
rows. This expression can refer to the columns of the
<command>VALUES</command> result as <literal>column1</literal>, <literal>column2</literal>,
etc. For more details see
<xref linkend="sql-orderby" endterm="sql-orderby-title"/>.
<xref linkend="sql-orderby"/>
in the <xref linkend="sql-select"/> documentation.
</para>
</listitem>
</varlistentry>
......@@ -95,7 +96,8 @@ VALUES ( <replaceable class="parameter">expression</replaceable> [, ...] ) [, ..
<listitem>
<para>
A sorting operator. For details see
<xref linkend="sql-orderby" endterm="sql-orderby-title"/>.
<xref linkend="sql-orderby"/>
in the <xref linkend="sql-select"/> documentation.
</para>
</listitem>
</varlistentry>
......@@ -105,7 +107,8 @@ VALUES ( <replaceable class="parameter">expression</replaceable> [, ...] ) [, ..
<listitem>
<para>
The maximum number of rows to return. For details see
<xref linkend="sql-limit" endterm="sql-limit-title"/>.
<xref linkend="sql-limit"/>
in the <xref linkend="sql-select"/> documentation.
</para>
</listitem>
</varlistentry>
......@@ -115,8 +118,8 @@ VALUES ( <replaceable class="parameter">expression</replaceable> [, ...] ) [, ..
<listitem>
<para>
The number of rows to skip before starting to return rows.
For details see
<xref linkend="sql-limit" endterm="sql-limit-title"/>.
For details see <xref linkend="sql-limit"/>
in the <xref linkend="sql-select"/> documentation.
</para>
</listitem>
</varlistentry>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment