提交 d72168d6 编写于 作者: T Thomas G. Lockhart

Complete first pass at markup adjustments for docbook2man man pages.

Add some internal cross references to select.sgml.
上级 d289011f
此差异已折叠。
<refentry id="SQL-SELECTINTO">
<refmeta>
<refentrytitle>
SELECT INTO
SELECT INTO
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
SELECT INTO
SELECT INTO
</refname>
<refpurpose>
Create a new table from an existing table or view
Create a new table from an existing table or view
</refpurpose></refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
......@@ -37,7 +37,8 @@ SELECT [ ALL | DISTINCT ] <replaceable class="PARAMETER">expression</replaceable
Inputs
</title>
<para>
All input fields are described in detail for SELECT.
All input fields are described in detail for
<xref linkend="select-title" endterm="select-title">.
</para>
</refsect2>
......@@ -49,7 +50,8 @@ All input fields are described in detail for SELECT.
Outputs
</title>
<para>
All output fields are described in detail for SELECT.
All output fields are described in detail for
<xref linkend="select-title" endterm="select-title">.
</para>
</refsect2>
</refsynopsisdiv>
......@@ -62,12 +64,14 @@ All output fields are described in detail for SELECT.
Description
</title>
<para>
SELECT INTO creates a new table from the results of a query. Typically, this
<command>SELECT INTO</command> creates a new table from the results
of a query. Typically, this
query draws data from an existing table, but any SQL query is allowed.
<note>
<para>
CREATE TABLE AS is functionally equivalent to the SELECT INTO command.
</para>
<para>
CREATE TABLE AS is functionally equivalent to the SELECT INTO command.
</para>
</note>
</para>
</refsect1>
......@@ -76,7 +80,7 @@ All output fields are described in detail for SELECT.
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
......
......@@ -201,9 +201,9 @@ default
Setting the <envar>PGDATESTYLE</envar> environment variable.
</member>
<member>
Running postmaster using the <option>-oe</option> parameter to set
Running postmaster using the option <option>-o -e</option> to set
dates to the <literal>European</literal> convention.
Note that this affects only the some combinations of date styles; for example
Note that this affects only some combinations of date styles; for example
the ISO style is not affected by this parameter.
</member>
<member>
......
......@@ -18,7 +18,7 @@
<date>1998-09-24</date>
</refsynopsisdivinfo>
<synopsis>
SHOW <replaceable class="PARAMETER">variable</replaceable>
SHOW <replaceable class="PARAMETER">keyword</replaceable>
</synopsis>
<refsect2 id="R2-SQL-SHOW-1">
......@@ -28,17 +28,15 @@ SHOW <replaceable class="PARAMETER">variable</replaceable>
<title>
Inputs
</title>
<para>
<para>
<variablelist>
<varlistentry>
<term>
<replaceable class="PARAMETER">variable</replaceable>
</term>
<term><replaceable class="PARAMETER">keyword</replaceable></term>
<listitem>
<para>
Refer to <command>SET</command> for more information on available
variables.
arguments.
</para>
</listitem>
</varlistentry>
......@@ -53,40 +51,40 @@ SHOW <replaceable class="PARAMETER">variable</replaceable>
<title>
Outputs
</title>
<para>
<para>
<variablelist>
<varlistentry>
<term>
<returnvalue>NOTICE: <replaceable
class="PARAMETER">">variab</replaceable>E> is <replaceable>value</replaceable></returnvalue>
SHOW VARIABLE
</term>
<term><computeroutput>
NOTICE: <replaceable class="PARAMETER">variable</replaceable> is <replaceable>value</replaceable>
SHOW VARIABLE
</computeroutput></term>
<listitem>
<para>
Message returned if successfully.
Message returned if successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<returnvalue>NOTICE: Unrecognized variable <replaceable>value</replaceable></returnvalue>
</term>
<term><computeroutput>
NOTICE: Unrecognized variable <replaceable>value</replaceable>
</computeroutput></term>
<listitem>
<para>
Message returned if <returnvalue>value</returnvalue> does not exist.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
NOTICE: Time zone is unknown
SHOW VARIABLE
</term>
<term><computeroutput>
NOTICE: Time zone is unknown
SHOW VARIABLE
</computeroutput></term>
<listitem>
<para>
If the TZ environment variable is not set.
If the <envar>TZ</envar> or <envar>PGTZ</envar> environment
variable is not set.
</para>
</listitem>
</varlistentry>
......@@ -138,12 +136,17 @@ SHOW <replaceable class="PARAMETER">variable</replaceable>
Usage
</title>
<para>
Show the current <literal>DateStyle</literal> setting:
<programlisting>
-- show DateStyle;
SHOW DateStyle;
NOTICE:DateStyle is Postgres with US (NonEuropean) conventions
</programlisting>
</para>
-- show Geqo;
<para>
Show the current genetic optimizer (<literal>geqo</literal>) setting:
<programlisting>
SHOW GEQO;
NOTICE:GEQO is ON
</programlisting>
......@@ -183,7 +186,7 @@ sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG"
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
<REFENTRY ID="SQL-UNLISTEN">
<REFMETA>
<REFENTRYTITLE>
UNLISTEN
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
UNLISTEN
</REFNAME>
<REFPURPOSE>
Stop listening for notification
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-19</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
UNLISTEN { <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> | * }
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-UNLISTEN-1">
<REFSECT2INFO>
<DATE>1998-10-19</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Name of previously registered notify condition.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>*</literal>
</TERM>
<LISTITEM>
<PARA>
All current listen registrations for this backend are cleared.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-UNLISTEN-2">
<REFSECT2INFO>
<DATE>1998-10-19</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<refentry id="SQL-UNLISTEN">
<refmeta>
<refentrytitle>
UNLISTEN
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
UNLISTEN
</refname>
<refpurpose>
Stop listening for notification
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-19</date>
</refsynopsisdivinfo>
<synopsis>
UNLISTEN { <replaceable class="PARAMETER">notifyname</replaceable> | * }
</synopsis>
<refsect2 id="R2-SQL-UNLISTEN-1">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">notifyname</replaceable></term>
<listitem>
<para>
Name of previously registered notify condition.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>*</literal></term>
<listitem>
<para>
All current listen registrations for this backend are cleared.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-UNLISTEN-2">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
<returnvalue>UNLISTEN</returnvalue>
</TERM>
<LISTITEM>
<PARA>
Acknowledgement that statement has executed.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-UNLISTEN-1">
<REFSECT1INFO>
<DATE>1998-10-19</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<command>UNLISTEN</command>
is used to remove an existing <command>NOTIFY</command> registration.
UNLISTEN cancels any existing registration of the current
<productname>Postgres</productname> session as a listener on the notify
condition <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>.
The special condition wildcard "*" cancels all listener registrations
for the current session.
</para>
<para>
<xref linkend="sql-notify" endterm="sql-notify-ref">
contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
<REFSECT2 ID="R2-SQL-UNLISTEN-3">
<REFSECT2INFO>
<DATE>1998-10-19</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<para>
<REPLACEABLE CLASS="PARAMETER">classname</REPLACEABLE>
needs not to be a valid class name but can be any string valid
as a name up to 32 characters long.
</para>
<para>
The backend does not complain if you UNLISTEN something you were not
listening for.
Each backend will automatically execute <command>UNLISTEN *</command> when
exiting.
</para>
<para>
A restriction in some previous releases of
<productname>Postgres</productname> that a
<REPLACEABLE CLASS="PARAMETER">classname</REPLACEABLE>
which does not correspond to an actual table must be enclosed in double-quotes
is no longer present.
</para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-UNLISTEN-2">
<TITLE>
Usage
</TITLE>
<para>
<programlisting>
</computeroutput></term>
<listitem>
<para>
Acknowledgement that statement has executed.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-UNLISTEN-1">
<refsect1info>
<date>1998-10-19</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>UNLISTEN</command>
is used to remove an existing <command>NOTIFY</command> registration.
UNLISTEN cancels any existing registration of the current
<productname>Postgres</productname> session as a listener on the notify
condition <replaceable class="PARAMETER">notifyname</replaceable>.
The special condition wildcard "*" cancels all listener registrations
for the current session.
</para>
<para>
<xref endterm="sql-notify-ref" linkend="sql-notify">
contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
<refsect2 id="R2-SQL-UNLISTEN-3">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
Notes
</title>
<para>
<replaceable class="PARAMETER">classname</replaceable>
needs not to be a valid class name but can be any string valid
as a name up to 32 characters long.
</para>
<para>
The backend does not complain if you UNLISTEN something you were not
listening for.
Each backend will automatically execute <command>UNLISTEN *</command> when
exiting.
</para>
<para>
A restriction in some previous releases of
<productname>Postgres</productname> that a
<replaceable class="PARAMETER">classname</replaceable>
which does not correspond to an actual table must be enclosed in double-quotes
is no longer present.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-UNLISTEN-2">
<title>
Usage
</title>
<para>
To subscribe to an existing registration:
<programlisting>
postgres=> LISTEN virtual;
LISTEN
postgres=> NOTIFY virtual;
NOTIFY
ASYNC NOTIFY of 'virtual' from backend pid '12317' received
</programlisting>
</programlisting>
</para>
<programlisting>
<para>
Once UNLISTEN has been executed, further NOTIFY commands will be
ignored:
<programlisting>
postgres=> UNLISTEN virtual;
UNLISTEN
postgres=> NOTIFY virtual;
NOTIFY
-- notice no NOTIFY event is received
postgres=>
</programlisting>
</para>
</REFSECT1>
<REFSECT1 ID="R1-SQL-UNLISTEN-3">
<TITLE>
Compatibility
</TITLE>
<REFSECT2 ID="R2-SQL-UNLISTEN-4">
<REFSECT2INFO>
<DATE>1998-10-19</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>UNLISTEN</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</REFENTRY>
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-UNLISTEN-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-UNLISTEN-4">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>UNLISTEN</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
<REFENTRY ID="SQL-UPDATE">
<REFMETA>
<REFENTRYTITLE>
UPDATE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
UPDATE
</REFNAME>
<REFPURPOSE>
Replaces values of columns in a table
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-24</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
UPDATE <REPLACEABLE CLASS="PARAMETER">table</replaceable> SET <REPLACEABLE CLASS="PARAMETER">column</replaceable> = <REPLACEABLE CLASS="PARAMETER">expression</replaceable> [, ...]
[ FROM <REPLACEABLE CLASS="PARAMETER">fromlist</REPLACEABLE> ]
[ WHERE <REPLACEABLE CLASS="PARAMETER">condition</REPLACEABLE> ]
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-UPDATE-1">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">table</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of an existing table.
</para>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">column</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of a column in <REPLACEABLE CLASS="PARAMETER">table</replaceable>.
</para>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">expression</replaceable>
</TERM>
<LISTITEM>
<PARA>
A valid expression or value to assign to column.
</para>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">fromlist</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
A <productname>Postgres</productname>
non-standard extension to allow columns
from other tables to appear in the WHERE condition.
</para>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">condition</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Refer to the SELECT statement for a further description
of the WHERE clause.
</para>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para>
</REFSECT2>
<REFSECT2 ID="R2-SQL-UPDATE-2">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
UPDATE <replaceable class="parameter">#</replaceable>
</TERM>
<LISTITEM>
<PARA>
Message returned if successful.
The <replaceable class="parameter">#</replaceable>
means the number of rows updated.
If <replaceable class="parameter">#</replaceable>
is equal 0 no rows are updated.
</para>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-UPDATE-1">
<REFSECT1INFO>
<DATE>1998-09-24</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
UPDATE changes the values of the columns specified for
all rows which satisfy condition. Only the columns
to be modified need appear as column.
</para>
<PARA>
Array references use the same syntax found in SELECT.
That is, either single array elements, a range of array
elements or the entire array may be replaced with a single
query.
</para>
<PARA>
You must have write access to the table in order to modify
it, as well as read access to any table whose values are
mentioned in the WHERE condition.
</para>
</REFSECT1>
<REFSECT1 ID="R1-SQL-UPDATE-2">
<TITLE>
Usage
</TITLE>
<PARA>
</PARA>
<ProgramListing>
--Change word "Drama" with "Dramatic" on column kind:
--
UPDATE films
SET kind = 'Dramatic'
WHERE kind = 'Drama';
SELECT * FROM films WHERE kind = 'Dramatic' OR kind = 'Drama';
<refentry id="SQL-UPDATE">
<refmeta>
<refentrytitle>
UPDATE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
UPDATE
</refname>
<refpurpose>
Replaces values of columns in a table
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-24</date>
</refsynopsisdivinfo>
<synopsis>
UPDATE <replaceable class="PARAMETER">table</replaceable> SET <replaceable class="PARAMETER">R">col</replaceable>le> = <replaceable class="PARAMETER">expression</replaceable> [, ...]
[ FROM <replaceable class="PARAMETER">fromlist</replaceable> ]
[ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
</synopsis>
<refsect2 id="R2-SQL-UPDATE-1">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
The name of an existing table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">column</replaceable></term>
<listitem>
<para>
The name of a column in <replaceable class="PARAMETER">table</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">expression</replaceable></term>
<listitem>
<para>
A valid expression or value to assign to column.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">fromlist</replaceable></term>
<listitem>
<para>
A <productname>Postgres</productname>
non-standard extension to allow columns
from other tables to appear in the WHERE condition.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">condition</replaceable></term>
<listitem>
<para>
Refer to the SELECT statement for a further description
of the WHERE clause.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-UPDATE-2">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
UPDATE <replaceable class="parameter">#</replaceable>
</computeroutput></term>
<listitem>
<para>
Message returned if successful.
The <replaceable class="parameter">#</replaceable>
means the number of rows updated.
If <replaceable class="parameter">#</replaceable>
is equal 0 no rows are updated.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-UPDATE-1">
<refsect1info>
<date>1998-09-24</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>UPDATE</command> changes the values of the columns specified for
all rows which satisfy condition. Only the columns
to be modified need appear as column.
</para>
<para>
Array references use the same syntax found in SELECT.
That is, either single array elements, a range of array
elements or the entire array may be replaced with a single
query.
</para>
<para>
You must have write access to the table in order to modify
it, as well as read access to any table whose values are
mentioned in the WHERE condition.
</para>
</refsect1>
<refsect1 id="R1-SQL-UPDATE-2">
<title>
Usage
</title>
<para>
Change word "Drama" with "Dramatic" on column kind:
<programlisting>
UPDATE films
SET kind = 'Dramatic'
WHERE kind = 'Drama';
SELECT * FROM films WHERE kind = 'Dramatic' OR kind = 'Drama';
code |title |did| date_prod|kind |len
-----+-------------+---+----------+----------+------
......@@ -166,35 +157,52 @@ UPDATE <REPLACEABLE CLASS="PARAMETER">table</replaceable> SET <REPLACEABLE CLASS
M_401|War and Peace|104|1967-02-12|Dramatic | 05:57
T_601|Yojimbo |106|1961-06-16|Dramatic | 01:50
DA101|Das Boot |110|1981-11-11|Dramatic | 02:29
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-UPDATE-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-UPDATE-4">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
SQL92 defines a different syntax for positioned UPDATE statement:
<programlisting>
UPDATE table SET column = expression [, ...]
WHERE CURRENT OF <replaceable class="parameter">cursor</replaceable>
</programlisting>
where <replaceable class="parameter">cursor</replaceable>
identifies an open cursor.
</para>
</refsect2>
</refsect1>
</REFENTRY>
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-UPDATE-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-UPDATE-4">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
SQL92
</title>
<para>
SQL92 defines a different syntax for positioned UPDATE statement:
<synopsis>
UPDATE table SET column = expression [, ...]
WHERE CURRENT OF <replaceable class="parameter">cursor</replaceable>
</synopsis>
where <replaceable class="parameter">cursor</replaceable>
identifies an open cursor.
</para>
</refsect2>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
<REFENTRY ID="SQL-VACUUM-1">
<REFMETA>
<REFENTRYTITLE id="vacuum">
VACUUM
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
VACUUM
</REFNAME>
<REFPURPOSE>
Clean and analyze a <productname>Postgres</productname> database
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-04</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
VACUUM [ VERBOSE ] [ ANALYZE ] [ <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ]
VACUUM [ VERBOSE ] ANALYZE [ <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> [ (<REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> [, ...] ) ] ]
</SYNOPSIS>
<refentry id="SQL-VACUUM-1">
<refmeta>
<refentrytitle id="vacuum">
VACUUM
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
VACUUM
</refname>
<refpurpose>
Clean and analyze a <productname>Postgres</productname> database
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-04</date>
</refsynopsisdivinfo>
<synopsis>
VACUUM [ VERBOSE ] [ ANALYZE ] [ <replaceable class="PARAMETER">table</replaceable> ]
VACUUM [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">ER">t</replaceable>BLE> [ (<replaceable class="PARAMETER">column</replaceable> [, ...] ) ] ]
</synopsis>
<refsect2 id="R2-SQL-VACUUM-1">
<refsect2info>
<date>1998-10-04</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term>VERBOSE</term>
<listitem>
<para>
Prints a detailed vacuum activity report for each table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ANALYZE</term>
<listitem>
<para>
Updates column statistics used by the optimizer to
determine the most efficient way to execute a query.
The statistics represent the disbursion of the data in each column.
This information is valuable when several execution paths are possible.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
The name of a specific table to vacuum. Defaults to all tables.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">column</replaceable></term>
<listitem>
<para>
The name of a specific column to analyze. Defaults to all columns.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-VACUUM-2">
<refsect2info>
<date>1998-10-04</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
<returnvalue>VACUUM</returnvalue>
</computeroutput></term>
<listitem>
<para>
The command has been accepted and the database is being cleaned.
</para>
</listitem>
</varlistentry>
<REFSECT2 ID="R2-SQL-VACUUM-1">
<REFSECT2INFO>
<DATE>1998-10-04</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
VERBOSE
</term>
<LISTITEM>
<PARA>
Prints a detailed vacuum activity report for each table.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
ANALYZE
</term>
<LISTITEM>
<PARA>
Updates column statistics used by the optimizer to
determine the most efficient way to execute a query.
The statistics represent the disbursion of the data in each column.
This information is valuable when several execution paths are possible.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</term>
<LISTITEM>
<PARA>
The name of a specific table to vacuum. Defaults to all tables.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE>
</term>
<LISTITEM>
<PARA>
The name of a specific column to analyze. Defaults to all columns.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
<varlistentry>
<term><computeroutput>
NOTICE: --Relation <replaceable class="PARAMETER">table</replaceable>--
</computeroutput></term>
<listitem>
<para>
The report header for <replaceable class="PARAMETER">table</replaceable>.
</para>
</listitem>
</varlistentry>
<REFSECT2 ID="R2-SQL-VACUUM-2">
<REFSECT2INFO>
<DATE>1998-10-04</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<varlistentry>
<term><computeroutput>
NOTICE: Pages 98: Changed 25, Reapped 74, Empty 0, New 0;
Tup 1000: Vac 3000, Crash 0, UnUsed 0, MinLen 188, MaxLen 188;
Re-using: Free/Avail. Space 586952/586952; EndEmpty/Avail. Pages 0/74.
Elapsed 0/0 sec.
</computeroutput></term>
<listitem>
<para>
The analysis for <replaceable class="PARAMETER">table</replaceable> itself.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
NOTICE: Index <replaceable class="PARAMETER">index</replaceable>: Pages 28;
Tuples 1000: Deleted 3000. Elapsed 0/0 sec.
</computeroutput></term>
<listitem>
<para>
The analysis for an index on the target table.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>VACUUM</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
The command has been accepted and the database is being cleaned.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
NOTICE: --Relation <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>--
</term>
<LISTITEM>
<PARA>
The report header for <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>.
</para>
</listitem>
</varlistentry>
<refsect1 id="R1-SQL-VACUUM-1">
<refsect1info>
<date>1998-10-04</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>VACUUM</command> serves two purposes in
<productname>Postgres</productname> as both a means to reclaim storage and
also a means to collect information for the optimizer.
</para>
<VARLISTENTRY>
<TERM>
NOTICE: Pages 98: Changed 25, Reapped 74, Empty 0, New 0;
Tup 1000: Vac 3000, Crash 0, UnUsed 0, MinLen 188, MaxLen 188;
Re-using: Free/Avail. Space 586952/586952; EndEmpty/Avail. Pages 0/74.
Elapsed 0/0 sec.
</term>
<LISTITEM>
<PARA>
The analysis for <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> itself.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
NOTICE: Index <REPLACEABLE CLASS="PARAMETER">index</REPLACEABLE>: Pages 28;
Tuples 1000: Deleted 3000. Elapsed 0/0 sec.
</term>
<LISTITEM>
<PARA>
The analysis for an index on the target table.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<para>
<command>VACUUM</command> opens every class in the database,
cleans out records from rolled back transactions, and updates statistics in the
system catalogs. The statistics maintained include the number of
tuples and number of pages stored in all classes.
</para>
<REFSECT1 ID="R1-SQL-VACUUM-1">
<REFSECT1INFO>
<DATE>1998-10-04</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<command>VACUUM</command> serves two purposes in
<productname>Postgres</productname> as both a means to reclaim storage and
also a means to collect information for the optimizer.
</para>
<para>
<command>VACUUM</command> opens every class in the database,
cleans out records from rolled back transactions, and updates statistics in the
system catalogs. The statistics maintained include the number of
tuples and number of pages stored in all classes.
<para>
Running <command>VACUUM</command>
periodically will increase the speed of the database in processing user queries.
</para>
Running <command>VACUUM</command>
periodically will increase the speed of the database in processing user queries.
</para>
<refsect2 id="R2-SQL-VACUUM-3">
<refsect2info>
<date>1998-10-04</date>
</refsect2info>
<title>
Notes
</title>
<para>
The open database is the target for <command>VACUUM</command>.
</para>
<para>
We recommend that active production databases be cleaned nightly, in order
to keep statistics relatively current. The <command>VACUUM</command>
query may be executed at any time, however. In particular, after
copying a large class into <productname>Postgres</productname>
or after deleting a large number of
records, it may be a good idea to issue a <command>VACUUM</command>
query. This will update the system catalogs with the results of all
recent changes, and allow the <productname>Postgres</productname>
query optimizer to make better choices in planning user queries.
</para>
<para>
If the server crashes during a <command>VACUUM</command> command,
chances are it will leave a lock file hanging around.
Attempts to re-run the <command>VACUUM</command> command
result in an error message about the creation of a lock file. If you
are sure <command>VACUUM</command> is not running,
remove the <filename>pg_vlock</filename> file in your
database directory
(i.e. <filename><envar>PGDATA</envar>/base/dbname/pg_vlock</filename>).
</para>
</refsect2>
</refsect1>
<REFSECT2 ID="R2-SQL-VACUUM-3">
<REFSECT2INFO>
<DATE>1998-10-04</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
The open database is target for <command>VACUUM</command>.
</para>
<para>
We recommend that active production databases be cleaned nightly, in order
to keep statistics relatively current. The <command>VACUUM</command>
query may be executed at any time, however. In particular, after
copying a large class into <productname>Postgres</productname>
or after deleting a large number of
records, it may be a good idea to issue a <command>VACUUM</command>
query. This will update the system catalogs with the results of all
recent changes, and allow the <productname>Postgres</productname>
query optimizer to make better choices in planning user queries.
</para>
<para>
If the server crashes during a <command>VACUUM</command> command,
chances are it will leave a lock file hanging around.
Attempts to re-run the <command>VACUUM</command> command
result in an error message about the creation of a lock file. If you
are sure <command>VACUUM</command> is not running,
remove the <filename>pg_vlock</filename> file in your
database directory
(i.e. <filename><envar>PGDATA</envar>/base/dbname/pg_vlock</filename>).
</PARA>
</REFSECT2>
</refsect1>
<refsect1 id="R1-SQL-VACUUM-2">
<title>
Usage
</title>
<para>
The following is an example from running <command>VACUUM</command> on a table
in the regression database:
<REFSECT1 ID="R1-SQL-VACUUM-2">
<TITLE>
Usage
</TITLE>
<PARA>
The following is an example from running <command>VACUUM</command> on a table
in the regression database:
<ProgramListing>
<programlisting>
regression=> vacuum verbose analyze onek;
NOTICE: --Relation onek--
NOTICE: Pages 98: Changed 25, Reapped 74, Empty 0, New 0;
......@@ -223,24 +217,41 @@ NOTICE: Index onek_hundred: Pages 12; Tuples 1000: Deleted 1000. Elapsed 0/0 se
NOTICE: Index onek_unique2: Pages 19; Tuples 1000: Deleted 1000. Elapsed 0/0 sec.
NOTICE: Index onek_unique1: Pages 17; Tuples 1000: Deleted 1000. Elapsed 0/0 sec.
VACUUM
</ProgramListing>
</para>
</REFSECT1>
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-VACUUM-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-VACUUM-4">
<refsect2info>
<date>1998-10-04</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>VACUUM</command> statement in SQL92.
</para>
</refsect2>
</refsect1>
</refentry>
<REFSECT1 ID="R1-SQL-VACUUM-3">
<TITLE>
Compatibility
</TITLE>
<REFSECT2 ID="R2-SQL-VACUUM-4">
<REFSECT2INFO>
<DATE>1998-10-04</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <COMMAND>VACUUM</COMMAND> statement in SQL92.
</para>
</refsect2>
</refsect1>
</REFENTRY>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
......@@ -18,12 +18,9 @@
<date>1998-10-04</date>
</refsynopsisdivinfo>
<synopsis>
vacuumdb [ --analyze | -z ] [ --verbose | -v ] [ <replaceable
class="parameter">dbname</replaceable> ]
vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
<replaceable class="parameter">port</replaceable> ]
[ --table '<replaceable class="parameter">table</replaceable> [ (
<replaceable class="parameter">column</replaceable> [,...] ) ]' ]
vacuumdb [ --analyze | -z ] [ --verbose | -v ] [ <replaceable class="parameter">dbname</replaceable> ]
vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ --table '<replaceable class="parameter">table</replaceable> [ ( <replaceable class="parameter">column</replaceable> [,...] ) ]' ]
[ <replaceable class="parameter">dbname</replaceable> ]
</synopsis>
......@@ -39,9 +36,7 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
<variablelist>
<varlistentry>
<term>
<replaceable class="parameter">dbname</replaceable>
</term>
<term><replaceable class="parameter">dbname</replaceable></term>
<listitem>
<para>
Specifies the name of the database to be cleaned or analyzed.
......@@ -52,44 +47,30 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
--analyze
</term>
<term>
-z
</term>
<term>--analyze</term>
<term>-z</term>
<listitem>
<para>
Calculate statistics on the database for use by the optimizer.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
--verbose
</term>
<term>
-v
</term>
<term>--verbose</term>
<term>-v</term>
<listitem>
<para>
Print detailed information during processing.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
--table <replaceable class="parameter">table</replaceable> [
(<replaceable class="parameter">column</replaceable> [,...]) ]
</term>
<term>
-t <replaceable class="parameter">table</replaceable> [
(<replaceable class="parameter">column</replaceable> [,...]) ]
</term>
<term>--table <replaceable class="parameter">table</replaceable> [ (<replaceable class="parameter">column</replaceable> [,...]) ]</term>
<term>-t <replaceable class="parameter">table</replaceable> [ (<replaceable class="parameter">column</replaceable> [,...]) ]</term>
<listitem>
<para>
Clean or analyze <replaceable class="parameter">table</replaceable> only.
......@@ -98,18 +79,17 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
<application>vacuumdb</application> also accepts
the following command line arguments for connection parameters:
<variablelist>
<varlistentry>
<term>
-h <replaceable class="parameter">host</replaceable>
</term>
<term>-h <replaceable class="parameter">host</replaceable></term>
<listitem>
<para>
Specifies the hostname of the machine on which the
......@@ -119,11 +99,9 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-p <replaceable class="parameter">port</replaceable>
</term>
<term>-p <replaceable class="parameter">port</replaceable></term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
......@@ -134,11 +112,9 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-u
</term>
<term>-u</term>
<listitem>
<para>
Use password authentication.
......@@ -148,7 +124,6 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
......@@ -166,11 +141,10 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
<variablelist>
<varlistentry>
<term>
ERROR: Can't vacuum columns, only tables. You can 'vacuum analyze' columns.
vacuumdb: database vacuum failed on <replaceable
class="parameter">dbname</replaceable>.
</term>
<term><computeroutput>
ERROR: Can't vacuum columns, only tables. You can 'vacuum analyze' columns.
vacuumdb: database vacuum failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
The non-analyze mode requires cleaning full tables or databases.
......@@ -180,11 +154,11 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
</varlistentry>
<varlistentry>
<term>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
</term>
<term><computeroutput>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
</computeroutput></term>
<listitem>
<para>
<application>vacuumdb</application> could not attach to the
......@@ -199,10 +173,10 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
</varlistentry>
<varlistentry>
<term>
Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
</term>
<term><computeroutput>
Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
</computeroutput></term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
......@@ -211,7 +185,6 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
......@@ -234,7 +207,7 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
<title>
Description
</title>
<para>
<application>vacuumdb</application> is a utility for cleaning a
<productname>Postgres</productname> database.
......@@ -250,7 +223,7 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
<title>
Notes
</title>
<para>
See <xref endterm="vacuum" linkend="vacuum"> for more details.
</para>
......@@ -267,22 +240,23 @@ vacuumdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p
To clean a database of the same name as the user:
<programlisting>
% vacuumdb
% vacuumdb
</programlisting>
</para>
<para>
To analyze a database named <literal>bigdb</literal> for the optimizer:
<programlisting>
% vacuumdb --analyze bigdb
% vacuumdb --analyze bigdb
</programlisting>
</para>
<para>
To analyze a single column <literal>bar</literal> in table <literal>foo</literal>
in a database named <literal>xyzzy</literal> for the optimizer:
<programlisting>
% vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy
% vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy
</programlisting>
</para>
</refsect1>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册