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