Commit 20aae304 authored by Peter Eisentraut's avatar Peter Eisentraut

Editing of more reference pages.

parent 3a496c8a
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/abort.sgml,v 1.12 2003/04/15 13:25:08 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/abort.sgml,v 1.13 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -32,6 +32,22 @@ ABORT [ WORK | TRANSACTION ]
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><literal>WORK</literal></term>
<term><literal>TRANSACTION</literal></term>
<listitem>
<para>
Optional key words. They have no effect.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Diagnostics</title>
......@@ -71,7 +87,7 @@ ABORT [ WORK | TRANSACTION ]
<para>
To abort all changes:
<programlisting>
ABORT WORK;
ABORT;
</programlisting>
</para>
</refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/deallocate.sgml,v 1.1 2002/08/27 04:55:07 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/deallocate.sgml,v 1.2 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -8,114 +8,79 @@ PostgreSQL documentation
<refentrytitle id="sql-deallocate-title">DEALLOCATE</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
DEALLOCATE
</refname>
<refpurpose>
remove a prepared query
</refpurpose>
<refname>DEALLOCATE</refname>
<refpurpose>deallocate a prepared statement</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>2002-08-12</date>
</refsynopsisdivinfo>
<synopsis>
DEALLOCATE [ PREPARE ] <replaceable class="PARAMETER">plan_name</replaceable>
</synopsis>
<refsect2 id="R2-SQL-DEALLOCATE-1">
<refsect2info>
<date>2002-08-12</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term>PREPARE</term>
<listitem>
<para>
This keyword is ignored.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">plan_name</replaceable></term>
<listitem>
<para>
The name of the prepared query to remove.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-DEALLOCATE-2">
<refsect2info>
<date>2002-08-12</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
<returnvalue>DEALLOCATE</returnvalue>
</computeroutput></term>
<listitem>
<para>
The prepared query was removed successfully.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsynopsisdiv>
<synopsis>
DEALLOCATE [ PREPARE ] <replaceable class="parameter">plan_name</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-SQL-DEALLOCATE-1">
<refsect1info>
<date>2002-08-12</date>
</refsect1info>
<title>
Description
</title>
<refsect1>
<title>Description</title>
<para>
<command>DEALLOCATE</command> is used to remove a previously
prepared query. If you do not explicitly
<command>DEALLOCATE</command> a prepared query, it is removed when
the session ends.
<command>DEALLOCATE</command> is used to deallocate a previously
prepared SQL statement. If you do not explicitly deallocate a
prepared statement, it is deallocated when the session ends.
</para>
<para>
For more information on prepared queries, see <xref
For more information on prepared statements, see <xref
linkend="sql-prepare" endterm="sql-prepare-title">.
</para>
</refsect1>
<refsect1 id="R1-SQL-DEALLOCATE-2">
<title>
Compatibility
</title>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><literal>PREPARE</literal></term>
<listitem>
<para>
This key word is ignored.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">plan_name</replaceable></term>
<listitem>
<para>
The name of the prepared statement to deallocate.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>DEALLOCATE</computeroutput></term>
<listitem>
<para>
Message returned if the prepared statement was deallocated successfully.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect2 id="R2-SQL-DEALLOCATE-3">
<refsect2info>
<date>2002-08-12</date>
</refsect2info>
<title>
SQL92
</title>
<para>
SQL92 includes a <command>DEALLOCATE</command> statement, but it is
only for use in embedded SQL clients.
</para>
</refsect2>
<refsect1>
<title>Compatibility</title>
<para>
The SQL standard includes a <command>DEALLOCATE</command>
statement, but it is only for use in embedded SQL.
</para>
</refsect1>
</refentry>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/delete.sgml,v 1.16 2002/04/23 02:07:16 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/delete.sgml,v 1.17 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -8,105 +8,28 @@ PostgreSQL documentation
<refentrytitle id="SQL-DELETE-TITLE">DELETE</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
DELETE
</refname>
<refpurpose>
delete rows of a table
</refpurpose>
<refnamediv>
<refname>DELETE</refname>
<refpurpose>delete rows of a table</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
<synopsis>
DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
</synopsis>
<refsect2 id="R2-SQL-DELETE-1">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">table</replaceable></term>
<listitem>
<para>
The name (optionally schema-qualified) of an existing table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">condition</replaceable></term>
<listitem>
<para>
This is an SQL selection query which returns the rows which
are to be deleted.
</para>
<para>
Refer to the SELECT statement for further description
of the WHERE clause.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-DELETE-2">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
DELETE <replaceable class="parameter">count</replaceable>
</computeroutput></term>
<listitem>
<para>
Message returned if items are successfully deleted. The
<replaceable class="parameter">count</replaceable> is the number
of rows deleted.
</para>
<para>
If <replaceable class="parameter">count</replaceable> is 0,
no rows were deleted.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-SQL-DELETE-1">
<refsect1info>
<date>1998-04-15</date>
</refsect1info>
<title>
Description
</title>
<refsect1>
<title>Description</title>
<para>
<command>DELETE</command> removes rows which satisfy the WHERE
clause from the specified table.
<command>DELETE</command> deletes rows that satisfy the
<literal>WHERE</literal> clause from the specified table. If the
<literal>WHERE</literal> clause is absent, the effect is to delete
all rows in the table. The result is a valid, but empty table.
</para>
<para>
If the <firstterm>condition</firstterm> (WHERE clause) is absent,
the effect is to delete all rows in the table.
The result is a valid, but empty table.
<tip>
<para>
<xref linkend="sql-truncate" endterm="sql-truncate-title"> is a
......@@ -114,39 +37,74 @@ DELETE <replaceable class="parameter">count</replaceable>
faster mechanism to remove all rows from a table.
</para>
</tip>
</para>
<para>
By default DELETE will delete tuples in the table specified
and all its sub-tables. If you wish to only update the
specific table mentioned, you should use the ONLY clause.
By default, <command>DELETE</command> will delete rows in the
specified table and all its subtables. If you wish to only delete
from the specific table mentioned, you must use the
<literal>ONLY</literal> clause.
</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
read in the <replaceable class="parameter">condition</replaceable>.
You must have the <literal>DELETE</literal> privilege on the table
to delete from it, as well as the <literal>SELECT</literal>
privilege to any table whose values are read in the <replaceable
class="parameter">condition</replaceable>.
</para>
</refsect1>
<refsect1 id="R1-SQL-DELETE-2">
<title>
Usage
</title>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">table</replaceable></term>
<listitem>
<para>
The name (optionally schema-qualified) of an existing table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">condition</replaceable></term>
<listitem>
<para>
A value expression that returns a value of type
<type>boolean</type> that determines the rows which are to be
deleted.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>DELETE <replaceable class="parameter">count</replaceable></computeroutput></term>
<listitem>
<para>
Message returned if rows are successfully deleted. The
<replaceable class="parameter">count</replaceable> is the number
of rows deleted. If <replaceable
class="parameter">count</replaceable> is 0, no rows were
deleted.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Remove all films but musicals:
Delete all films but musicals:
<programlisting>
DELETE FROM films WHERE kind &lt;&gt; 'Musical';
SELECT * FROM films;
<computeroutput>
code | title | did | date_prod | kind | len
-------+---------------------------+-----+------------+---------+-------
UA501 | West Side Story | 105 | 1961-01-03 | Musical | 02:32
TC901 | The King and I | 109 | 1956-08-11 | Musical | 02:13
WD101 | Bed Knobs and Broomsticks | 111 | | Musical | 01:57
(3 rows)
</computeroutput>
</programlisting>
</para>
......@@ -154,42 +112,16 @@ SELECT * FROM films;
Clear the table <literal>films</literal>:
<programlisting>
DELETE FROM films;
SELECT * FROM films;
<computeroutput>
code | title | did | date_prod | kind | len
------+-------+-----+-----------+------+-----
(0 rows)
</computeroutput>
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DELETE-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-DELETE-4">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<acronym>SQL92</acronym> allows a positioned DELETE statement:
<synopsis>
DELETE FROM <replaceable class="parameter">table</replaceable> WHERE
CURRENT OF <replaceable class="parameter">cursor</replaceable>
</synopsis>
where <replaceable class="parameter">cursor</replaceable>
identifies an open cursor.
Interactive cursors in <productname>PostgreSQL</productname> are read-only.
</para>
</refsect2>
<refsect1>
<title>Compatibility</title>
<para>
This command conforms to the SQL standard.
</para>
</refsect1>
</refentry>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/end.sgml,v 1.8 2002/04/21 19:02:39 thomas Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/end.sgml,v 1.9 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -8,145 +8,99 @@ PostgreSQL documentation
<refentrytitle id="SQL-END-TITLE">END</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
END
</refname>
<refpurpose>
commit the current transaction
</refpurpose>
</refnamediv>
<refname>END</refname>
<refpurpose>commit the current transaction</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
<synopsis>
END [ WORK | TRANSACTION ]
</synopsis>
<refsect2 id="R2-SQL-END-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term>WORK</term>
<term>TRANSACTION</term>
<listitem>
<para>
Optional keywords. They have no effect.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-END-2">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
COMMIT
</computeroutput></term>
<listitem>
<para>
Message returned if the transaction is successfully committed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
WARNING: COMMIT: no transaction in progress
</computeroutput></term>
<listitem>
<para>
If there is no transaction in progress.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-SQL-END-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
Description
</title>
<refsect1>
<title>Description</title>
<para>
<command>END</command> is a <productname>PostgreSQL</productname>
extension, and is a synonym for the SQL92-compatible
<xref linkend="sql-commit" endterm="sql-commit-title">.
<command>END</command> commits the current transaction. All changes
made by the transaction become visible to others and are guaranteed
to be durable if a crash occurs. It is a PostgreSQL extension that
is equivalent to <xref linkend="sql-commit"
endterm="sql-commit-title">.
</para>
</refsect1>
<refsect2 id="R2-SQL-END-3">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Notes
</title>
<para>
The keywords WORK and TRANSACTION are noise and can be omitted.
</para>
<refsect1>
<title>Parameters</title>
<para>
Use <xref linkend="SQL-ROLLBACK" endterm="SQL-ROLLBACK-TITLE">
to abort a transaction.
</para>
</refsect2>
<variablelist>
<varlistentry>
<term><literal>WORK</literal></term>
<term><literal>TRANSACTION</literal></term>
<listitem>
<para>
Optional key words. They have no effect.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>COMMIT</computeroutput></term>
<listitem>
<para>
Message returned if the transaction was successfully committed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>WARNING: COMMIT: no transaction in progress</computeroutput></term>
<listitem>
<para>
Message if there is no transaction in progress.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Notes</title>
<refsect1 id="R1-SQL-END-2">
<title>
Usage
</title>
<para>
To make all changes permanent:
Use <xref linkend="SQL-ROLLBACK" endterm="SQL-ROLLBACK-TITLE"> to
abort a transaction.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<programlisting>
END WORK;
</programlisting>
<para>
To commit the current transaction and make all changes permanent:
<programlisting>
END;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-END-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-END-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<command>END</command> is a <productname>PostgreSQL</productname>
extension which provides functionality equivalent to
<xref linkend="sql-commit" endterm="sql-commit-title">.
</para>
</refsect2>
<refsect1>
<title>Compatibility</title>
<para>
<command>END</command> is a <productname>PostgreSQL</productname>
extension that provides functionality equivalent to <xref
linkend="sql-commit" endterm="sql-commit-title">, which is
specified in the SQL standard.
</para>
</refsect1>
</refentry>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/execute.sgml,v 1.3 2003/02/02 23:46:37 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/execute.sgml,v 1.4 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -8,128 +8,100 @@ PostgreSQL documentation
<refentrytitle id="sql-execute-title">EXECUTE</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
EXECUTE
</refname>
<refpurpose>
execute a prepared query
</refpurpose>
<refname>EXECUTE</refname>
<refpurpose>execute a prepared statement</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>2002-08-12</date>
</refsynopsisdivinfo>
<synopsis>
EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ] [ INTO [ TEMPORARY | TEMP ] <replaceable class="PARAMETER">table</replaceable> ]
</synopsis>
<refsect2 id="R2-SQL-EXECUTE-1">
<refsect2info>
<date>2002-08-12</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">plan_name</replaceable></term>
<listitem>
<para>
The name of the prepared query to execute.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">parameter</replaceable></term>
<listitem>
<para>
The actual value of a parameter to the prepared query. This
must be an expression yielding a value of a type compatible
with the data-type specified for this parameter position in
the <command>PREPARE</command> statement that created the
prepared query.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
The name of the table in which to store the results of
executing the query (if it is a <command>SELECT</command>). If
no table is specified, the results are returned to the client
(as normal).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsynopsisdiv>
<synopsis>
EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ] [ INTO [ TEMPORARY | TEMP ] <replaceable class="PARAMETER">table</replaceable> ]
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-SQL-EXECUTE-1">
<refsect1info>
<date>2002-08-12</date>
</refsect1info>
<title>
Description
</title>
<refsect1>
<title>Description</title>
<para>
<command>EXECUTE</command> is used to execute a previously prepared
query. Since prepared queries only exist for the duration of a
session, the prepared query must have been created by a
statement. Since prepared statements only exist for the duration of a
session, the prepared statement must have been created by a
<command>PREPARE</command> statement executed earlier in the
current session.
</para>
<para>
If the <command>PREPARE</command> statement that created the query
If the <command>PREPARE</command> statement that created the statement
specified some parameters, a compatible set of parameters must be
passed to the <command>EXECUTE</command> statement, or else an
error is raised. Note that (unlike functions) prepared queries are
not overloaded based on the type or number of their parameters: the
name of a prepared query must be unique within a database session.
error is raised. Note that (unlike functions) prepared statements are
not overloaded based on the type or number of their parameters; the
name of a prepared statement must be unique within a database session.
</para>
<para>
Like <command>SELECT INTO</command>, <command>EXECUTE</command> can
store the results of executing the query into a newly-created
table, by specifying an INTO clause. For more information on this behavior,
store the results of executing a query into a newly-created
table, by specifying an <literal>INTO</> clause. For more information on this behavior,
see <xref linkend="sql-selectinto" endterm="sql-selectinto-title">.
</para>
<para>
For more information on the creation and usage of prepared queries,
For more information on the creation and usage of prepared statements,
see <xref linkend="sql-prepare" endterm="sql-prepare-title">.
</para>
</refsect1>
<refsect1 id="R1-SQL-EXECUTE-2">
<title>
Compatibility
</title>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">plan_name</replaceable></term>
<listitem>
<para>
The name of the prepared statement to execute.
</para>
</listitem>
</varlistentry>
<refsect2 id="R2-SQL-EXECUTE-2">
<refsect2info>
<date>2002-08-12</date>
</refsect2info>
<title>
SQL92
</title>
<para>
SQL92 includes an <command>EXECUTE</command> statement, but it is
only for use in embedded SQL clients. The
<command>EXECUTE</command> statement implemented by
<productname>PostgreSQL</productname> also uses a somewhat
different syntax.
</para>
</refsect2>
<varlistentry>
<term><replaceable class="PARAMETER">parameter</replaceable></term>
<listitem>
<para>
The actual value of a parameter to the prepared statement. This
must be an expression yielding a value of a type compatible with
the data type specified for this parameter position in the
<command>PREPARE</command> command that created the prepared
statement.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
The name of the table in which to store the results of executing
the statement (if it is a <command>SELECT</command>). If no
table is specified, the results are returned to the client (as
normal).
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
The SQL standard includes an <command>EXECUTE</command> statement,
but it is only for use in embedded SQL. This version of the
<command>EXECUTE</command> statement also uses a somewhat different
syntax.
</para>
</refsect1>
</refentry>
......
This diff is collapsed.
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/grant.sgml,v 1.32 2003/01/23 23:38:53 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/grant.sgml,v 1.33 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -43,10 +43,10 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
<title>Description</title>
<para>
The <command>GRANT</command> command gives specific permissions on
The <command>GRANT</command> command gives specific privileges on
an object (table, view, sequence, database, function, procedural language,
or schema) to
one or more users or groups of users. These permissions are added
one or more users or groups of users. These privileges are added
to those already granted, if any.
</para>
......@@ -55,18 +55,18 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
privileges are to be granted to all users, including those that may
be created later. <literal>PUBLIC</literal> may be thought of as an
implicitly defined group that always includes all users.
Note that any particular user will have the sum
Any particular user will have the sum
of privileges granted directly to him, privileges granted to any group he
is presently a member of, and privileges granted to
<literal>PUBLIC</literal>.
</para>
<para>
There is no need to grant privileges to the creator of an object,
as the creator has all privileges by default. (The creator could,
There is no need to grant privileges to the owner of an object (usually the user that created it),
as the owner has all privileges by default. (The owner could,
however, choose to revoke some of his own privileges for safety.)
Note that the right to drop an object, or to alter it in any way is
not described by a grantable right; it is inherent in the creator,
The right to drop an object, or to alter it in any way is
not described by a grantable right; it is inherent in the owner,
and cannot be granted or revoked.
</para>
......@@ -84,7 +84,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
<literal>TEMP</> table creation privilege for databases;
<literal>EXECUTE</> privilege for functions; and
<literal>USAGE</> privilege for languages.
The object creator may of course revoke these privileges. (For maximum
The object owner may of course revoke these privileges. (For maximum
security, issue the <command>REVOKE</> in the same transaction that
creates the object; then there is no window in which another user
may use the object.)
......@@ -252,7 +252,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
</para>
<para>
It should be noted that database <firstterm>superusers</> can access
It should be noted that database superusers can access
all objects regardless of object privilege settings. This
is comparable to the rights of <literal>root</> in a Unix system.
As with <literal>root</>, it's unwise to operate as a superuser
......@@ -267,17 +267,18 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
</para>
<para>
Use <xref linkend="app-psql">'s <command>\dp</command> command
Use <xref linkend="app-psql">'s <command>\z</command> command
to obtain information about existing privileges, for example:
<programlisting>
lusitania=> \dp mytable
=> \z mytable
Access privileges for database "lusitania"
Schema | Table | Access privileges
--------+---------+---------------------------------------
public | mytable | {=r/postgres,miriam=arwdRxt/postgres,"group todos=arw/postgres"}
(1 row)
</programlisting>
The entries shown by <command>\dp</command> are interpreted thus:
The entries shown by <command>\z</command> are interpreted thus:
<programlisting>
=xxxx -- privileges granted to PUBLIC
uname=xxxx -- privileges granted to a user
......@@ -305,14 +306,14 @@ lusitania=> \dp mytable
<programlisting>
GRANT SELECT ON mytable TO PUBLIC;
GRANT SELECT,UPDATE,INSERT ON mytable TO GROUP todos;
GRANT SELECT, UPDATE, INSERT ON mytable TO GROUP todos;
</programlisting>
</para>
<para>
If the <quote>Access privileges</> column is empty for a given object,
it means the object has default privileges (that is, its privileges field
is NULL). Default privileges always include all privileges for the owner,
it means the object has default privileges (that is, its privileges columm
is null). Default privileges always include all privileges for the owner,
and may include some privileges for <literal>PUBLIC</> depending on the
object type, as explained above. The first <command>GRANT</> or
<command>REVOKE</> on an object
......@@ -325,7 +326,7 @@ will instantiate the default privileges (producing, for example,
<title>Examples</title>
<para>
Grant insert privilege to all users on table films:
Grant insert privilege to all users on table <literal>films</literal>:
<programlisting>
GRANT INSERT ON films TO PUBLIC;
......@@ -344,37 +345,35 @@ GRANT ALL PRIVILEGES ON kinds TO manuel;
<refsect1 id="sql-grant-compatibility">
<title>Compatibility</title>
<refsect2>
<title>SQL92</title>
<para>
The <literal>PRIVILEGES</literal> key word in <literal>ALL
PRIVILEGES</literal> is required. <acronym>SQL</acronym> does not
support setting the privileges on more than one table per command.
According to the SQL standard, the <literal>PRIVILEGES</literal>
key word in <literal>ALL PRIVILEGES</literal> is required. The
SQL standard does not support setting the privileges on more than
one object per command.
</para>
<para>
The <acronym>SQL</acronym> syntax for <literal>GRANT</literal>
allows setting privileges for individual columns within a table:
The SQL standard allows setting privileges for individual columns
within a table:
<synopsis>
GRANT <replaceable class="PARAMETER">privilege</replaceable> [, ...]
GRANT <replaceable class="PARAMETER">privileges</replaceable>
ON <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ] [, ...]
TO { PUBLIC | <replaceable class="PARAMETER">username</replaceable> [, ...] } [ WITH GRANT OPTION ]
</synopsis>
</para>
<para>
<acronym>SQL</acronym> allows to grant the USAGE privilege on
other kinds of objects: CHARACTER SET, COLLATION, TRANSLATION, DOMAIN.
The SQL standard provides for a <literal>USAGE</literal> privilege
on other kinds of objects: character sets, collations,
translations, domains.
</para>
<para>
The TRIGGER privilege was introduced in SQL99. The RULE privilege
is a PostgreSQL extension.
The <literal>RULE</literal> privilege, and privileges on
databases, schemas, languages, and sequences are PostgreSQL
extensions.
</para>
</refsect2>
</refsect1>
......
This diff is collapsed.
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/listen.sgml,v 1.15 2002/09/21 18:32:54 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/listen.sgml,v 1.16 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -8,121 +8,54 @@ PostgreSQL documentation
<refentrytitle id="SQL-LISTEN-TITLE">LISTEN</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
LISTEN
</refname>
<refpurpose>
listen for a notification
</refpurpose>
<refname>LISTEN</refname>
<refpurpose>listen for a notification</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
<synopsis>
LISTEN <replaceable class="PARAMETER">name</replaceable>
</synopsis>
<refsect2 id="R2-SQL-LISTEN-1">
<refsect2info>
<date>1998-10-07</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
Name of notify condition.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-LISTEN-2">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
LISTEN
</computeroutput></term>
<listitem>
<para>
Message returned upon successful completion of registration.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
WARNING: Async_Listen: We are already listening on <replaceable class="PARAMETER">name</replaceable>
</computeroutput></term>
<listitem>
<para>
If this backend is already registered for that notify condition.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-SQL-LISTEN-1">
<refsect1info>
<date>1998-10-07</date>
</refsect1info>
<title>
Description
</title>
<refsect1>
<title>Description</title>
<para>
<command>LISTEN</command> registers the current
<productname>PostgreSQL</productname> backend as a
listener on the notify condition
<replaceable class="PARAMETER">name</replaceable>.
<command>LISTEN</command> registers the current session as a
listener on the notification condition <replaceable
class="PARAMETER">name</replaceable>.
</para>
<para>
Whenever the command
<command>NOTIFY <replaceable class="PARAMETER">name</replaceable></command>
is invoked, either by this backend or another one connected to
the same database, all the backends currently listening on that notify
condition are notified, and each will in turn notify its connected
frontend application. See the discussion of <command>NOTIFY</command>
for more information.
Whenever the command <command>NOTIFY <replaceable
class="PARAMETER">name</replaceable></command> is invoked, either
by this session or another one connected to the same database, all
the sessions currently listening on that notification condition are
notified, and each will in turn notify its connected client
application. See the discussion of <command>NOTIFY</command> for
more information.
</para>
<para>
A backend can be unregistered for a given notify condition with the
<command>UNLISTEN</command> command. Also, a backend's listen registrations
are automatically cleared when the backend process exits.
A session can be unregistered for a given notify condition with the
<command>UNLISTEN</command> command. A session's listen
registrations are automatically cleared when the session ends.
</para>
<para>
The method a frontend application must use to detect notify events depends on
The method a client application must use to detect notification events depends on
which <productname>PostgreSQL</productname> application programming interface it
uses. With the <application>libpq</> library, the application issues
<command>LISTEN</command> as an ordinary SQL command, and then must
periodically call the routine <function>PQnotifies</function> to find out
whether any notify events have been received. Other interfaces such as
periodically call the function <function>PQnotifies</function> to find out
whether any notification events have been received. Other interfaces such as
<application>libpgtcl</> provide higher-level methods for handling notify events; indeed,
with <application>libpgtcl</> the application programmer should not even issue
<command>LISTEN</command> or <command>UNLISTEN</command> directly. See the
documentation for the library you are using for more details.
documentation for the interface you are using for more details.
</para>
<para>
......@@ -131,64 +64,67 @@ WARNING: Async_Listen: We are already listening on <replaceable class="PARAMETE
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
Name of a notify condition (any identifier).
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect2 id="R2-SQL-LISTEN-3">
<refsect2info>
<date>1998-10-07</date>
</refsect2info>
<title>
Notes
</title>
<para>
<replaceable class="PARAMETER">name</replaceable>
can be any string valid as a name;
it need not correspond to the name of any actual table. If
<replaceable class="PARAMETER">notifyname</replaceable>
is enclosed in double-quotes, it need not even be a syntactically
valid name, but can be any string up to 63 characters long.
</para>
<para>
In some previous releases of
<productname>PostgreSQL</productname>,
<replaceable class="PARAMETER">name</replaceable>
had to be enclosed in double-quotes when it did not correspond to any existing
table name, even if syntactically valid as a name. That is no longer required.
</para>
</refsect2>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>LISTEN</computeroutput></term>
<listitem>
<para>
Message returned upon successful completion of registration.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>WARNING: Async_Listen: We are already listening on <replaceable class="PARAMETER">name</replaceable></computeroutput></term>
<listitem>
<para>
Message returned if this session is already registered for that notification condition.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="R1-SQL-LISTEN-2">
<title>
Usage
</title>
<refsect1>
<title>Examples</title>
<para>
Configure and execute a listen/notify sequence from <application>psql</application>:
<programlisting>
LISTEN virtual;
NOTIFY virtual;
Asynchronous NOTIFY 'virtual' from backend with pid '8448' received.
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-LISTEN-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-LISTEN-4">
<refsect2info>
<date>1998-09-01</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>LISTEN</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
<refsect1>
<title>Compatibility</title>
<para>
There is no <command>LISTEN</command> statement in the SQL
standard.
</para>
</refsect1>
</refentry>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.16 2003/03/25 16:15:42 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.17 2003/04/26 23:56:51 petere Exp $
-->
<refentry id="SQL-LOAD">
......@@ -23,11 +23,11 @@ LOAD '<replaceable class="PARAMETER">filename</replaceable>'
<title>Description</title>
<para>
Loads a shared library file into the <productname>PostgreSQL</>
backend's address space. If the file had been loaded previously,
This command loads a shared library file into the <productname>PostgreSQL</>
server's address space. If the file had been loaded previously,
it is first unloaded. This command is primarily useful to unload
and reload a shared library file that has been changed since the
backend first loaded it. To make use of the shared library,
server first loaded it. To make use of the shared library,
function(s) in it need to be declared using the <xref
linkend="sql-createfunction" endterm="sql-createfunction-title">
command.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/revoke.sgml,v 1.25 2003/01/23 23:38:53 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/revoke.sgml,v 1.26 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -53,19 +53,19 @@ REVOKE [ GRANT OPTION FOR ]
<title>Description</title>
<para>
<command>REVOKE</command> allows the creator of an object to revoke
previously granted permissions from one or more users or groups of users.
The key word <literal>PUBLIC</literal> refers to the implicitly defined
group of all users.
The <command>REVOKE</command> command revokes previously granted
privileges from one or more users or groups of users. The key word
<literal>PUBLIC</literal> refers to the implicitly defined group of
all users.
</para>
<para>
Note that any particular user will have the sum
of privileges granted directly to him, privileges granted to any group he
is presently a member of, and privileges granted to
<literal>PUBLIC</literal>. Thus, for example, revoking SELECT privilege
<literal>PUBLIC</literal>. Thus, for example, revoking <literal>SELECT</> privilege
from <literal>PUBLIC</literal> does not necessarily mean that all users
have lost SELECT privilege on the object: those who have it granted
have lost <literal>SELECT</> privilege on the object: those who have it granted
directly or via a group will still have it.
</para>
......@@ -138,15 +138,12 @@ REVOKE ALL PRIVILEGES ON kinds FROM manuel;
<refsect1 id="SQL-REVOKE-compatibility">
<title>Compatibility</title>
<refsect2>
<title>SQL92</title>
<para>
The compatibility notes of the <xref linkend="sql-grant" endterm="sql-grant-title"> command
apply analogously to <command>REVOKE</command>. The syntax summary is:
<synopsis>
REVOKE [ GRANT OPTION FOR ] { SELECT | INSERT | UPDATE | DELETE | REFERENCES }
REVOKE [ GRANT OPTION FOR ] <replaceable class="PARAMETER">privileges</replaceable>
ON <replaceable class="parameter">object</replaceable> [ ( <replaceable class="parameter">column</replaceable> [, ...] ) ]
FROM { PUBLIC | <replaceable class="parameter">username</replaceable> [, ...] }
{ RESTRICT | CASCADE }
......@@ -154,7 +151,6 @@ REVOKE [ GRANT OPTION FOR ] { SELECT | INSERT | UPDATE | DELETE | REFERENCES }
One of <literal>RESTRICT</literal> or <literal>CASCADE</literal>
is required.
</para>
</refsect2>
</refsect1>
<refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/rollback.sgml,v 1.13 2002/05/18 15:44:47 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/rollback.sgml,v 1.14 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -8,129 +8,95 @@ PostgreSQL documentation
<refentrytitle id="SQL-ROLLBACK-TITLE">ROLLBACK</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
ROLLBACK
</refname>
<refpurpose>
abort the current transaction
</refpurpose>
<refname>ROLLBACK</refname>
<refpurpose>abort the current transaction</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
<synopsis>
ROLLBACK [ WORK | TRANSACTION ]
</synopsis>
<refsect2 id="R2-SQL-ROLLBACK-1">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Inputs
</title>
<para>
None.
</para>
</refsect2>
<refsect2 id="R2-SQL-ROLLBACK-2">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
ROLLBACK
</computeroutput></term>
<listitem>
<para>
Message returned if successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
WARNING: ROLLBACK: no transaction in progress
</computeroutput></term>
<listitem>
<para>
If there is not any transaction currently in progress.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-SQL-ROLLBACK-1">
<refsect1info>
<date>1998-09-24</date>
</refsect1info>
<title>
Description
</title>
<refsect1>
<title>Description</title>
<para>
<command>ROLLBACK</command> rolls back the current transaction and causes
all the updates made by the transaction to be discarded.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<refsect2 id="R2-SQL-ROLLBACK-3">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Notes
</title>
<para>
Use <xref linkend="SQL-COMMIT" endterm="SQL-COMMIT-TITLE">
to successfully terminate a transaction.
<xref linkend="SQL-ABORT" endterm="SQL-ABORT-TITLE"> is a
synonym for <command>ROLLBACK</command>.
</para>
</refsect2>
<variablelist>
<varlistentry>
<term><literal>WORK</literal></term>
<term><literal>TRANSACTION</literal></term>
<listitem>
<para>
Optional key words. They have no effect.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="R1-SQL-ROLLBACK-2">
<title>
Usage
</title>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>ROLLBACK</computeroutput></term>
<listitem>
<para>
Message returned if successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>WARNING: ROLLBACK: no transaction in progress</computeroutput></term>
<listitem>
<para>
If there is not any transaction currently in progress.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Notes</title>
<para>
To abort all changes:
Use <xref linkend="SQL-COMMIT" endterm="SQL-COMMIT-TITLE"> to
successfully terminate a transaction.
</para>
</refsect1>
<programlisting>
ROLLBACK WORK;
</programlisting>
<refsect1>
<title>Examples</title>
<para>
To abort all changes:
<programlisting>
ROLLBACK;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-ROLLBACK-3">
<title>
Compatibility
</title>
<refsect1>
<title>Compatibility</title>
<refsect2 id="R2-SQL-ROLLBACK-4">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<acronym>SQL92</acronym> only specifies the two forms <literal>ROLLBACK</literal>
and <literal>ROLLBACK WORK</literal>. Otherwise full compatibility.
</para>
</refsect2>
<para>
The SQL standard only specifies the two forms
<literal>ROLLBACK</literal> and <literal>ROLLBACK
WORK</literal>. Otherwise, this command is fully conforming.
</para>
</refsect1>
</refentry>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.4 2003/01/10 22:03:27 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.5 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-START-TRANSACTION">
<docinfo>
<date>2002-07-26</date>
</docinfo>
<refmeta>
<refentrytitle id="SQL-START-TRANSACTION-TITLE">START TRANSACTION</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
......@@ -19,58 +15,9 @@ PostgreSQL documentation
</refnamediv>
<refsynopsisdiv>
<synopsis>
<synopsis>
START TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]
</synopsis>
<refsect2 id="R2-SQL-START-TRANSACTION-1">
<refsect2info>
<date>1998-09-27</date>
</refsect2info>
<title>
Inputs
</title>
<para>
None.
</para>
</refsect2>
<refsect2 id="R2-SQL-START-TRANSACTION-2">
<refsect2info>
<date>1998-09-27</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
START TRANSACTION
</computeroutput></term>
<listitem>
<para>
Message returned if successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
WARNING: BEGIN: already a transaction in progress
</computeroutput></term>
<listitem>
<para>
If there is already a transaction in progress when the
command is issued.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</synopsis>
</refsynopsisdiv>
<refsect1>
......@@ -84,15 +31,50 @@ WARNING: BEGIN: already a transaction in progress
respects, the behavior of this command is identical to the <xref
linkend="sql-begin" endterm="sql-begin-title"> command.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<para>
See under <xref linkend="sql-set-transaction"
endterm="sql-set-transaction-title"> about the meaning of the
parameters.
</para>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>START TRANSACTION</computeroutput></term>
<listitem>
<para>
Message returned if successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>WARNING: BEGIN: already a transaction in progress</computeroutput></term>
<listitem>
<para>
Message returned if there was already a transaction in progress
when the command was issued.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="R1-SQL-START-TRANSACTION-3">
<refsect1>
<title>Compatibility</title>
<para>
SQL99; but see also the compatibility section of <xref
linkend="sql-set-transaction" endterm="sql-set-transaction-title">.
This command conforms to the SQL standard; but see also the
compatibility section of <xref linkend="sql-set-transaction"
endterm="sql-set-transaction-title">.
</para>
</refsect1>
</refentry>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/truncate.sgml,v 1.9 2002/12/06 03:15:07 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/truncate.sgml,v 1.10 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -8,76 +8,21 @@ PostgreSQL documentation
<refentrytitle id="SQL-TRUNCATE-TITLE">TRUNCATE</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
TRUNCATE
</refname>
<refpurpose>
empty a table
</refpurpose>
<refname>TRUNCATE</refname>
<refpurpose>empty a table</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
<synopsis>
TRUNCATE [ TABLE ] <replaceable class="PARAMETER">name</replaceable>
</synopsis>
<refsect2 id="R2-SQL-TRUNCATE-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
The name (optionally schema-qualified) of the table to be truncated.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-TRUNCATE-2">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
TRUNCATE TABLE
</computeroutput></term>
<listitem>
<para>
Message returned if the table is successfully truncated.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-SQL-TRUNCATE-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
Description
</title>
<refsect1>
<title>Description</title>
<para>
<command>TRUNCATE</command> quickly removes all rows from a
table. It has the same effect as an unqualified
......@@ -85,36 +30,55 @@ TRUNCATE TABLE
table it is faster. This is most useful on large tables.
</para>
</refsect1>
<refsect1>
<title>Parameter</title>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
The name (optionally schema-qualified) of the table to be truncated.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>TRUNCATE TABLE</computeroutput></term>
<listitem>
<para>
Message returned if the table was successfully truncated.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<refsect1 id="R1-SQL-TRUNCATE-2">
<title>
Usage
</title>
<para>
Truncate the table <literal>bigtable</literal>:
<programlisting>
<programlisting>
TRUNCATE TABLE bigtable;
</programlisting>
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-TRUNCATE-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-TRUNCATE-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>TRUNCATE</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
<refsect1>
<title>Compatibility</title>
<para>
There is no <command>TRUNCATE</command> command in the SQL standard.
</para>
</refsect1>
</refentry>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/unlisten.sgml,v 1.20 2002/09/21 18:32:54 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/unlisten.sgml,v 1.21 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -8,93 +8,30 @@ PostgreSQL documentation
<refentrytitle>UNLISTEN</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
UNLISTEN
</refname>
<refpurpose>
stop listening for a notification
</refpurpose>
<refname>UNLISTEN</refname>
<refpurpose>stop listening for a 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>
</computeroutput></term>
<listitem>
<para>
Acknowledgment that statement has executed.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<synopsis>
UNLISTEN { <replaceable class="PARAMETER">name</replaceable> | * }
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-SQL-UNLISTEN-1">
<refsect1info>
<date>1998-10-19</date>
</refsect1info>
<title>
Description
</title>
<refsect1>
<title>Description</title>
<para>
<command>UNLISTEN</command>
is used to remove an existing <command>NOTIFY</command> registration.
<command>UNLISTEN</command> cancels any existing registration of the current
<productname>PostgreSQL</productname> session as a listener on the notify
condition <replaceable class="PARAMETER">notifyname</replaceable>.
The special condition wildcard <literal>*</literal> cancels all listener registrations
for the current session.
<command>UNLISTEN</command> is used to remove an existing
registration for <command>NOTIFY</command> events.
<command>UNLISTEN</command> cancels any existing registration of
the current <productname>PostgreSQL</productname> session as a
listener on the notification <replaceable
class="PARAMETER">name</replaceable>. The special wildcard
<literal>*</literal> cancels all listener registrations for the
current session.
</para>
<para>
......@@ -103,41 +40,69 @@ UNLISTEN { <replaceable class="PARAMETER">notifyname</replaceable> | * }
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
Name of a notification (any identifier).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>*</literal></term>
<listitem>
<para>
All current listen registrations for this session are cleared.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>UNLISTEN</computeroutput></term>
<listitem>
<para>
Message returned when the command has executed.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Notes</title>
<para>
You unlisten something you were not listening for; no warning or error will appear.
</para>
<refsect2 id="R2-SQL-UNLISTEN-3">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
Notes
</title>
<para>
<replaceable class="PARAMETER">notifyname</replaceable>
need not be a valid class name but can be any string valid
as a name up to 64 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>
</refsect2>
<para>
At the end of each session, <command>UNLISTEN *</command> ist
automatically executed.
</para>
</refsect1>
<refsect1 id="R1-SQL-UNLISTEN-2">
<title>
Usage
</title>
<refsect1>
<title>Examples</title>
<para>
To subscribe to an existing registration:
To make a registration:
<programlisting>
LISTEN virtual;
LISTEN
NOTIFY virtual;
NOTIFY
Asynchronous NOTIFY 'virtual' from backend with pid '8448' received
</programlisting>
</para>
......@@ -148,30 +113,18 @@ Asynchronous NOTIFY 'virtual' from backend with pid '8448' received
<programlisting>
UNLISTEN virtual;
UNLISTEN
NOTIFY virtual;
NOTIFY
-- notice no NOTIFY event is received
-- no NOTIFY event is received
</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>
<title>Compatibility</title>
<para>
There is no <command>UNLISTEN</command> command in the SQL standard.
</para>
</refsect1>
</refentry>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/update.sgml,v 1.20 2002/08/15 02:59:18 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/update.sgml,v 1.21 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation
-->
......@@ -8,204 +8,136 @@ PostgreSQL documentation
<refentrytitle id="SQL-UPDATE-TITLE">UPDATE</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
UPDATE
</refname>
<refpurpose>
update rows of a table
</refpurpose>
<refname>UPDATE</refname>
<refpurpose>update rows of a table</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> SET <replaceable class="PARAMETER">col</replaceable> = <replaceable class="PARAMETER">expression</replaceable> [, ...]
<synopsis>
UPDATE [ ONLY ] <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 (optionally schema-qualified) of an existing table. If
<literal>ONLY</> is specified, only that table is updated. If
<literal>ONLY</> is not specified, the table and all its
descendant tables (if any) are updated. <literal>*</> can be
appended to the table name to indicate that descendant tables are
to be scanned, but in the current version, this is the default
behavior. (In releases before 7.1, <literal>ONLY</> was the
default behavior.) The default can be altered by changing the
<option>SQL_INHERITANCE</option> configuration option.
</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>PostgreSQL</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 0 no rows are updated.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</synopsis>
</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 columns in the statement.
</para>
<refsect1>
<title>Description</title>
<para>
Array references use the same syntax found in
<xref linkend="sql-select" endterm="sql-select-title">.
That is, either single array elements, a range of array
elements or the entire array may be replaced with a single
query.
<command>UPDATE</command> changes the values of the specified
columns in all rows that satisfy the condition. Only the columns to
be modified need appear as columns in the statement.
</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.
By default, <command>UPDATE</command> will update rows in the
specified table and all its subtables. If you wish to only update
the specific table mentioned, you must use the <literal>ONLY</>
clause.
</para>
<para>
By default UPDATE will update tuples in the table specified
and all its sub-tables. If you wish to only update the
specific table mentioned, you should use the ONLY clause.
You must have the <literal>UPDATE</literal> privilege on the table
to update it, as well as the <literal>SELECT</literal>
privilege to any table whose values are read in the <replaceable
class="parameter">condition</replaceable>.
</para>
</refsect1>
<refsect1 id="R1-SQL-UPDATE-2">
<title>
Usage
</title>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
The name (optionally schema-qualified) of the table to update.
</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>
An expression or value to assign to the column.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">fromlist</replaceable></term>
<listitem>
<para>
A list of table expressions, allowing columns from other tables
to appear in the <literal>WHERE</> condition.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">condition</replaceable></term>
<listitem>
<para>
A value expression that returns a value of type
<type>boolean</type> that determines the rows which are to be
updated.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>UPDATE <replaceable class="parameter">count</replaceable></computeroutput></term>
<listitem>
<para>
Message returned if successful. The value <replaceable
class="parameter">count</replaceable> is the number of rows
updated. If <replaceable class="parameter">count</replaceable>
is 0, no rows were updated.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Change word <literal>Drama</> with <literal>Dramatic</> on column <structfield>kind</>:
Change the word <literal>Drama</> to <literal>Dramatic</> in the
column <structfield>kind</> of the table <literal>films</literal>:
<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
-------+---------------+-----+------------+----------+-------
BL101 | The Third Man | 101 | 1949-12-23 | Dramatic | 01:44
P_302 | Becket | 103 | 1964-02-03 | Dramatic | 02:28
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
UPDATE filme SET kind = 'Dramatic' WHERE kind = 'Drama';
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-UPDATE-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-UPDATE-4">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<acronym>SQL92</acronym> defines a different syntax for
the positioned UPDATE statement:
<synopsis>
UPDATE <replaceable>table</replaceable> SET <replaceable>column</replaceable> = <replaceable>expression</replaceable> [, ...]
WHERE CURRENT OF <replaceable class="parameter">cursor</replaceable>
</synopsis>
where <replaceable class="parameter">cursor</replaceable>
identifies an open cursor.
</para>
</refsect2>
<refsect1>
<title>Compatibility</title>
<para>
This command conforms to the SQL standard. The
<literal>FROM</literal> clause is a PostgreSQL extension.
</para>
</refsect1>
</refentry>
......
This diff is collapsed.
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