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> <refsynopsisdiv>
<refsynopsisdivinfo> <synopsis>
<date>2002-08-12</date> DEALLOCATE [ PREPARE ] <replaceable class="parameter">plan_name</replaceable>
</refsynopsisdivinfo> </synopsis>
<synopsis> </refsynopsisdiv>
DEALLOCATE [ PREPARE ] <replaceable class="PARAMETER">plan_name</replaceable>
</synopsis>
<refsect2 id="R2-SQL-DEALLOCATE-1"> <refsect1>
<refsect2info> <title>Description</title>
<date>2002-08-12</date>
</refsect2info>
<title>
Inputs
</title>
<para> <para>
<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 statements, see <xref
linkend="sql-prepare" endterm="sql-prepare-title">.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>PREPARE</term> <term><literal>PREPARE</literal></term>
<listitem> <listitem>
<para> <para>
This keyword is ignored. This key word is ignored.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">plan_name</replaceable></term> <term><replaceable class="parameter">plan_name</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of the prepared query to remove. The name of the prepared statement to deallocate.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect2 id="R2-SQL-DEALLOCATE-2"> <refsect1>
<refsect2info> <title>Diagnostics</title>
<date>2002-08-12</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>DEALLOCATE</computeroutput></term>
<returnvalue>DEALLOCATE</returnvalue>
</computeroutput></term>
<listitem> <listitem>
<para> <para>
The prepared query was removed successfully. Message returned if the prepared statement was deallocated successfully.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-DEALLOCATE-1">
<refsect1info>
<date>2002-08-12</date>
</refsect1info>
<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.
</para>
<para>
For more information on prepared queries, see <xref
linkend="sql-prepare" endterm="sql-prepare-title">.
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-DEALLOCATE-2"> <refsect1>
<title> <title>Compatibility</title>
Compatibility
</title>
<refsect2 id="R2-SQL-DEALLOCATE-3">
<refsect2info>
<date>2002-08-12</date>
</refsect2info>
<title>
SQL92
</title>
<para> <para>
SQL92 includes a <command>DEALLOCATE</command> statement, but it is The SQL standard includes a <command>DEALLOCATE</command>
only for use in embedded SQL clients. statement, but it is only for use in embedded SQL.
</para> </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,31 +8,54 @@ PostgreSQL documentation ...@@ -8,31 +8,54 @@ 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>
</refsynopsisdiv>
<refsect2 id="R2-SQL-DELETE-1">
<refsect2info> <refsect1>
<date>1998-04-15</date> <title>Description</title>
</refsect2info>
<title> <para>
Inputs <command>DELETE</command> deletes rows that satisfy the
</title> <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>
<tip>
<para> <para>
<xref linkend="sql-truncate" endterm="sql-truncate-title"> is a
<productname>PostgreSQL</productname> extension which provides a
faster mechanism to remove all rows from a table.
</para>
</tip>
<para>
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 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>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">table</replaceable></term> <term><replaceable class="parameter">table</replaceable></term>
...@@ -42,111 +65,46 @@ DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ WHERE ...@@ -42,111 +65,46 @@ DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ WHERE
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">condition</replaceable></term> <term><replaceable class="parameter">condition</replaceable></term>
<listitem> <listitem>
<para> <para>
This is an SQL selection query which returns the rows which A value expression that returns a value of type
are to be deleted. <type>boolean</type> that determines the rows which are to be
</para> deleted.
<para>
Refer to the SELECT statement for further description
of the WHERE clause.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect1>
<refsect2 id="R2-SQL-DELETE-2"> <title>Diagnostics</title>
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>DELETE <replaceable class="parameter">count</replaceable></computeroutput></term>
DELETE <replaceable class="parameter">count</replaceable>
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if items are successfully deleted. The Message returned if rows are successfully deleted. The
<replaceable class="parameter">count</replaceable> is the number <replaceable class="parameter">count</replaceable> is the number
of rows deleted. of rows deleted. If <replaceable
</para> class="parameter">count</replaceable> is 0, no rows were
<para> deleted.
If <replaceable class="parameter">count</replaceable> is 0,
no rows were deleted.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-DELETE-1">
<refsect1info>
<date>1998-04-15</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>DELETE</command> removes rows which satisfy the WHERE
clause from the specified 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
<productname>PostgreSQL</productname> extension which provides a
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.
</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>.
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-DELETE-2"> <refsect1>
<title> <title>Examples</title>
Usage
</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>
<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> <para>
identifies an open cursor. This command conforms to the SQL standard.
Interactive cursors in <productname>PostgreSQL</productname> are read-only.
</para> </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>
<refpurpose>
commit the current transaction
</refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <synopsis>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
END [ WORK | TRANSACTION ] END [ WORK | TRANSACTION ]
</synopsis> </synopsis>
</refsynopsisdiv>
<refsect2 id="R2-SQL-END-1">
<refsect2info> <refsect1>
<date>1998-09-08</date> <title>Description</title>
</refsect2info>
<title>
Inputs
</title>
<para> <para>
<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>
<refsect1>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>WORK</term> <term><literal>WORK</literal></term>
<term>TRANSACTION</term> <term><literal>TRANSACTION</literal></term>
<listitem> <listitem>
<para> <para>
Optional keywords. They have no effect. Optional key words. They have no effect.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect1>
<refsect2 id="R2-SQL-END-2"> <title>Diagnostics</title>
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>COMMIT</computeroutput></term>
COMMIT
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the transaction is successfully committed. Message returned if the transaction was successfully committed.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>WARNING: COMMIT: no transaction in progress</computeroutput></term>
WARNING: COMMIT: no transaction in progress
</computeroutput></term>
<listitem> <listitem>
<para> <para>
If there is no transaction in progress. Message if there is no transaction in progress.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-END-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<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">.
</para>
<refsect2 id="R2-SQL-END-3"> <refsect1>
<refsect2info> <title>Notes</title>
<date>1998-09-08</date>
</refsect2info>
<title>
Notes
</title>
<para>
The keywords WORK and TRANSACTION are noise and can be omitted.
</para>
<para> <para>
Use <xref linkend="SQL-ROLLBACK" endterm="SQL-ROLLBACK-TITLE"> Use <xref linkend="SQL-ROLLBACK" endterm="SQL-ROLLBACK-TITLE"> to
to abort a transaction. abort a transaction.
</para> </para>
</refsect2>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-END-2"> <refsect1>
<title> <title>Examples</title>
Usage
</title>
<para>
To make all changes permanent:
<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"> <refsect1>
<title> <title>Compatibility</title>
Compatibility
</title>
<refsect2 id="R2-SQL-END-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</title>
<para> <para>
<command>END</command> is a <productname>PostgreSQL</productname> <command>END</command> is a <productname>PostgreSQL</productname>
extension which provides functionality equivalent to extension that provides functionality equivalent to <xref
<xref linkend="sql-commit" endterm="sql-commit-title">. linkend="sql-commit" endterm="sql-commit-title">, which is
specified in the SQL standard.
</para> </para>
</refsect2>
</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,37 +8,60 @@ PostgreSQL documentation ...@@ -8,37 +8,60 @@ 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> <refsynopsisdiv>
<refsynopsisdivinfo> <synopsis>
<date>2002-08-12</date> EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ] [ INTO [ TEMPORARY | TEMP ] <replaceable class="PARAMETER">table</replaceable> ]
</refsynopsisdivinfo> </synopsis>
<synopsis> </refsynopsisdiv>
EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ] [ INTO [ TEMPORARY | TEMP ] <replaceable class="PARAMETER">table</replaceable> ]
</synopsis> <refsect1>
<title>Description</title>
<para>
<command>EXECUTE</command> is used to execute a previously prepared
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 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 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>
<refsect2 id="R2-SQL-EXECUTE-1"> <para>
<refsect2info> Like <command>SELECT INTO</command>, <command>EXECUTE</command> can
<date>2002-08-12</date> store the results of executing a query into a newly-created
</refsect2info> table, by specifying an <literal>INTO</> clause. For more information on this behavior,
<title> see <xref linkend="sql-selectinto" endterm="sql-selectinto-title">.
Inputs </para>
</title>
<para> <para>
For more information on the creation and usage of prepared statements,
see <xref linkend="sql-prepare" endterm="sql-prepare-title">.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">plan_name</replaceable></term> <term><replaceable class="PARAMETER">plan_name</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of the prepared query to execute. The name of the prepared statement to execute.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -47,11 +70,11 @@ PostgreSQL documentation ...@@ -47,11 +70,11 @@ PostgreSQL documentation
<term><replaceable class="PARAMETER">parameter</replaceable></term> <term><replaceable class="PARAMETER">parameter</replaceable></term>
<listitem> <listitem>
<para> <para>
The actual value of a parameter to the prepared query. This The actual value of a parameter to the prepared statement. This
must be an expression yielding a value of a type compatible must be an expression yielding a value of a type compatible with
with the data-type specified for this parameter position in the data type specified for this parameter position in the
the <command>PREPARE</command> statement that created the <command>PREPARE</command> command that created the prepared
prepared query. statement.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -60,76 +83,25 @@ PostgreSQL documentation ...@@ -60,76 +83,25 @@ PostgreSQL documentation
<term><replaceable class="PARAMETER">table</replaceable></term> <term><replaceable class="PARAMETER">table</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of the table in which to store the results of The name of the table in which to store the results of executing
executing the query (if it is a <command>SELECT</command>). If the statement (if it is a <command>SELECT</command>). If no
no table is specified, the results are returned to the client table is specified, the results are returned to the client (as
(as normal). normal).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-EXECUTE-1">
<refsect1info>
<date>2002-08-12</date>
</refsect1info>
<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
<command>PREPARE</command> statement executed earlier in the
current session.
</para>
<para>
If the <command>PREPARE</command> statement that created the query
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.
</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,
see <xref linkend="sql-selectinto" endterm="sql-selectinto-title">.
</para>
<para>
For more information on the creation and usage of prepared queries,
see <xref linkend="sql-prepare" endterm="sql-prepare-title">.
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-EXECUTE-2"> <refsect1>
<title> <title>Compatibility</title>
Compatibility
</title>
<refsect2 id="R2-SQL-EXECUTE-2">
<refsect2info>
<date>2002-08-12</date>
</refsect2info>
<title>
SQL92
</title>
<para> <para>
SQL92 includes an <command>EXECUTE</command> statement, but it is The SQL standard includes an <command>EXECUTE</command> statement,
only for use in embedded SQL clients. The but it is only for use in embedded SQL. This version of the
<command>EXECUTE</command> statement implemented by <command>EXECUTE</command> statement also uses a somewhat different
<productname>PostgreSQL</productname> also uses a somewhat syntax.
different syntax.
</para> </para>
</refsect2>
</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>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/insert.sgml,v 1.21 2003/03/25 16:15:42 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/insert.sgml,v 1.22 2003/04/26 23:56:51 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -8,29 +8,51 @@ PostgreSQL documentation ...@@ -8,29 +8,51 @@ PostgreSQL documentation
<refentrytitle id="SQL-INSERT-TITLE">INSERT</refentrytitle> <refentrytitle id="SQL-INSERT-TITLE">INSERT</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
<refname> <refname>INSERT</refname>
INSERT <refpurpose>create new rows in a table</refpurpose>
</refname>
<refpurpose>
create new rows in a table
</refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <synopsis>
<date>2000-08-08</date>
</refsynopsisdivinfo>
<synopsis>
INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ] INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ]
{ DEFAULT VALUES | VALUES ( { <replaceable class="PARAMETER">expression</replaceable> | DEFAULT } [, ...] ) | SELECT <replaceable class="PARAMETER">query</replaceable> } { DEFAULT VALUES | VALUES ( { <replaceable class="PARAMETER">expression</replaceable> | DEFAULT } [, ...] ) | <replaceable class="PARAMETER">query</replaceable> }
</synopsis> </synopsis>
</refsynopsisdiv>
<refsect2 id="R2-SQL-INSERT-1"> <refsect1>
<title> <title>Description</title>
Inputs
</title>
<para> <para>
<command>INSERT</command> allows one to insert new rows into a
table. One can insert
a single row at a time or several rows as a result of a query.
</para>
<para>
The columns in the target list may be listed in any order.
Each column not present in the target list will be inserted
using a default value, either a declared default value
or null.
</para>
<para>
If the expression for each column is not of the correct data type,
automatic type conversion will be attempted.
</para>
<para>
You must have <literal>INSERT</literal> privilege to a table in
order to insert into it. If you use the <replaceable
class="PARAMETER">query</replaceable> clause to insert rows from a
query, you also need to have <literal>SELECT</literal> privilege on
any table used in the query.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
...@@ -52,11 +74,10 @@ INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable ...@@ -52,11 +74,10 @@ INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>DEFAULT VALUES</term> <term><literal>DEFAULT VALUES</literal></term>
<listitem> <listitem>
<para> <para>
All columns will be filled by null values or by values specified All columns will be filled their default values.
when the table was created using <literal>DEFAULT</> clauses.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -65,18 +86,17 @@ INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable ...@@ -65,18 +86,17 @@ INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable
<term><replaceable class="PARAMETER">expression</replaceable></term> <term><replaceable class="PARAMETER">expression</replaceable></term>
<listitem> <listitem>
<para> <para>
A valid expression or value to assign to <replaceable An expression or value to assign to <replaceable
class="PARAMETER">column</replaceable>. class="PARAMETER">column</replaceable>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">DEFAULT</replaceable></term> <term><literal>DEFAULT</literal></term>
<listitem> <listitem>
<para> <para>
This column will be filled in by the column DEFAULT clause, or NULL if This column will be filled with its default value.
a default is not available.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -85,169 +105,110 @@ INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable ...@@ -85,169 +105,110 @@ INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable
<term><replaceable class="PARAMETER">query</replaceable></term> <term><replaceable class="PARAMETER">query</replaceable></term>
<listitem> <listitem>
<para> <para>
A valid query. Refer to the SELECT statement for a further description A query (<command>SELECT</command> statement) that supplies the
of valid arguments. rows to be inserted. Refer to the <command>SELECT</command>
statement for a description of the syntax.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect2 id="R2-SQL-INSERT-2"> <refsect1>
<title> <title>Diagnostics</title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>INSERT <replaceable>oid</replaceable> 1</computeroutput></term>
INSERT <replaceable>oid</replaceable> 1
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if only one row was inserted. Message returned if only one row was inserted.
<returnvalue><replaceable>oid</replaceable></returnvalue> <returnvalue><replaceable>oid</replaceable></returnvalue> is the
is the numeric <acronym>OID</acronym> of the inserted row. <acronym>OID</acronym> of the inserted row.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>INSERT 0 <replaceable>count</replaceable></computeroutput></term>
INSERT 0 <replaceable>#</replaceable>
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if more than one rows were inserted. Message returned if more than one rows were inserted.
<returnvalue><replaceable>#</replaceable></returnvalue> <replaceable>count</replaceable> is the number of rows inserted.
is the number of rows inserted.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-INSERT-1">
<title>
Description
</title>
<para>
<command>INSERT</command> allows one to insert new rows into a
table. One can insert
a single row at a time or several rows as a result of a query.
The columns in the target list may be listed in any order.
</para>
<para>
Each column not present in the target list will be inserted
using a default value, either a declared DEFAULT value
or NULL. <productname>PostgreSQL</productname> will reject the new
column if a NULL is inserted into a column declared NOT NULL.
</para>
<para>
If the expression for each column
is not of the correct data type, automatic type coercion will be
attempted.
</para>
<para>
You must have insert privilege to a table in order to append
to it, as well as select privilege on any table specified
in a WHERE clause.
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-INSERT-2"> <refsect1>
<title> <title>Examples</title>
Usage
</title>
<para> <para>
Insert a single row into table <literal>films</literal>: Insert a single row into table <literal>films</literal>:
<programlisting> <programlisting>
INSERT INTO films VALUES INSERT INTO films VALUES
('UA502','Bananas',105,'1971-07-13','Comedy',INTERVAL '82 minute'); ('UA502', 'Bananas', 105, '1971-07-13', 'Comedy', '82 minutes');
</programlisting> </programlisting>
</para> </para>
<para> <para>
In this second example the last column <literal>len</literal> is In this second example, the last column <literal>len</literal> is
omitted and therefore it will have the default value of NULL: omitted and therefore it will have the default value of null:
<programlisting> <programlisting>
INSERT INTO films (code, title, did, date_prod, kind) INSERT INTO films (code, title, did, date_prod, kind)
VALUES ('T_601', 'Yojimbo', 106, DATE '1961-06-16', 'Drama'); VALUES ('T_601', 'Yojimbo', 106, '1961-06-16', 'Drama');
</programlisting> </programlisting>
</para> </para>
<para> <para>
In the third example, we use the DEFAULT values for the date columns The third example uses the <literal>DEFAULT</literal> clause for
rather than specifying an entry. the date columns rather than specifying a value:
<programlisting> <programlisting>
INSERT INTO films VALUES INSERT INTO films VALUES
('UA502','Bananas',105,DEFAULT,'Comedy',INTERVAL '82 minute'); ('UA502', 'Bananas', 105, DEFAULT, 'Comedy', '82 minutes');
INSERT INTO films (code, title, did, date_prod, kind) INSERT INTO films (code, title, did, date_prod, kind)
VALUES ('T_601', 'Yojimbo', 106, DEFAULT, 'Drama'); VALUES ('T_601', 'Yojimbo', 106, DEFAULT, 'Drama');
</programlisting> </programlisting>
</para>
<para>
Insert a single row into table distributors; note that
only column <literal>name</literal> is specified, so the omitted
column <literal>did</literal> will be assigned its default value:
<programlisting>
INSERT INTO distributors (name) VALUES ('British Lion');
</programlisting>
</para> </para>
<para> <para>
Insert several rows into table films from table <literal>tmp</literal>: This examples inserts several rows into table
<literal>films</literal> from table <literal>tmp</literal>:
<programlisting> <programlisting>
INSERT INTO films SELECT * FROM tmp; INSERT INTO films SELECT * FROM tmp;
</programlisting> </programlisting>
</para> </para>
<para> <para>
Insert into arrays: This example inserts into array columns:
<programlisting> <programlisting>
-- Create an empty 3x3 gameboard for noughts-and-crosses -- Create an empty 3x3 gameboard for noughts-and-crosses
-- (all of these queries create the same board attribute) -- (all of these commands create the same board)
INSERT INTO tictactoe (game, board[1:3][1:3]) INSERT INTO tictactoe (game, board[1:3][1:3])
VALUES (1,'{{"","",""},{},{"",""}}'); VALUES (1,'{{"","",""},{},{"",""}}');
INSERT INTO tictactoe (game, board[3][3]) INSERT INTO tictactoe (game, board[3][3])
VALUES (2,'{}'); VALUES (2,'{}');
INSERT INTO tictactoe (game, board) INSERT INTO tictactoe (game, board)
VALUES (3,'{{,,},{,,},{,,}}'); VALUES (3,'{{,,},{,,},{,,}}');
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-INSERT-3"> <refsect1>
<title> <title>Compatibility</title>
Compatibility
</title>
<refsect2 id="R2-SQL-INSERT-4">
<title>
SQL92
</title>
<para> <para>
<command>INSERT</command> is fully compatible with <acronym>SQL92</acronym>. <command>INSERT</command> conforms fully to the SQL standard.
Possible limitations in features of the Possible limitations of the <replaceable
<replaceable class="PARAMETER">query</replaceable> class="PARAMETER">query</replaceable> clause are documented under
clause are documented for
<xref linkend="sql-select" endterm="sql-select-title">. <xref linkend="sql-select" endterm="sql-select-title">.
</para> </para>
</refsect2>
</refsect1> </refsect1>
</refentry> </refentry>
......
<!-- <!--
$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>
<title>
Notes
</title>
<variablelist>
<varlistentry>
<term><computeroutput>LISTEN</computeroutput></term>
<listitem>
<para> <para>
<replaceable class="PARAMETER">name</replaceable> Message returned upon successful completion of registration.
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>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>WARNING: Async_Listen: We are already listening on <replaceable class="PARAMETER">name</replaceable></computeroutput></term>
<listitem>
<para> <para>
In some previous releases of Message returned if this session is already registered for that notification condition.
<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> </para>
</refsect2> </listitem>
</varlistentry>
</variablelist>
</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>
<refsect2 id="R2-SQL-LISTEN-4">
<refsect2info>
<date>1998-09-01</date>
</refsect2info>
<title>
SQL92
</title>
<para> <para>
There is no <command>LISTEN</command> in <acronym>SQL92</acronym>. There is no <command>LISTEN</command> statement in the SQL
standard.
</para> </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,48 +8,49 @@ PostgreSQL documentation ...@@ -8,48 +8,49 @@ 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>
</refsynopsisdiv>
<refsect2 id="R2-SQL-ROLLBACK-1">
<refsect2info> <refsect1>
<date>1998-09-24</date> <title>Description</title>
</refsect2info>
<title>
Inputs
</title>
<para> <para>
None. <command>ROLLBACK</command> rolls back the current transaction and causes
all the updates made by the transaction to be discarded.
</para> </para>
</refsect2> </refsect1>
<refsect2 id="R2-SQL-ROLLBACK-2"> <refsect1>
<refsect2info> <title>Parameters</title>
<date>1998-09-24</date>
</refsect2info> <variablelist>
<title> <varlistentry>
Outputs <term><literal>WORK</literal></term>
</title> <term><literal>TRANSACTION</literal></term>
<listitem>
<para> <para>
Optional key words. They have no effect.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>ROLLBACK</computeroutput></term>
ROLLBACK
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if successful. Message returned if successful.
...@@ -58,9 +59,7 @@ ROLLBACK ...@@ -58,9 +59,7 @@ ROLLBACK
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>WARNING: ROLLBACK: no transaction in progress</computeroutput></term>
WARNING: ROLLBACK: no transaction in progress
</computeroutput></term>
<listitem> <listitem>
<para> <para>
If there is not any transaction currently in progress. If there is not any transaction currently in progress.
...@@ -68,69 +67,36 @@ WARNING: ROLLBACK: no transaction in progress ...@@ -68,69 +67,36 @@ WARNING: ROLLBACK: no transaction in progress
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-ROLLBACK-1"> <refsect1>
<refsect1info> <title>Notes</title>
<date>1998-09-24</date>
</refsect1info>
<title>
Description
</title>
<para> <para>
<command>ROLLBACK</command> rolls back the current transaction and causes Use <xref linkend="SQL-COMMIT" endterm="SQL-COMMIT-TITLE"> to
all the updates made by the transaction to be discarded. successfully terminate a transaction.
</para>
<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> </para>
</refsect2>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-ROLLBACK-2"> <refsect1>
<title> <title>Examples</title>
Usage
</title>
<para> <para>
To abort all changes: To abort all changes:
<programlisting>
<programlisting> ROLLBACK;
ROLLBACK WORK; </programlisting>
</programlisting>
</para> </para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-ROLLBACK-3"> <refsect1>
<title> <title>Compatibility</title>
Compatibility
</title>
<refsect2 id="R2-SQL-ROLLBACK-4">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
SQL92
</title>
<para> <para>
<acronym>SQL92</acronym> only specifies the two forms <literal>ROLLBACK</literal> The SQL standard only specifies the two forms
and <literal>ROLLBACK WORK</literal>. Otherwise full compatibility. <literal>ROLLBACK</literal> and <literal>ROLLBACK
WORK</literal>. Otherwise, this command is fully conforming.
</para> </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,80 +15,66 @@ PostgreSQL documentation ...@@ -19,80 +15,66 @@ 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>
</refsynopsisdiv>
<refsect2 id="R2-SQL-START-TRANSACTION-1"> <refsect1>
<refsect2info> <title>Description</title>
<date>1998-09-27</date>
</refsect2info>
<title>
Inputs
</title>
<para> <para>
None. This command begins a new transaction. If the isolation level or
read/write mode is specified, the new transaction has those
characteristics, as if <xref linkend="sql-set-transaction"
endterm="sql-set-transaction-title"> was executed. In all other
respects, the behavior of this command is identical to the <xref
linkend="sql-begin" endterm="sql-begin-title"> command.
</para> </para>
</refsect2> </refsect1>
<refsect2 id="R2-SQL-START-TRANSACTION-2"> <refsect1>
<refsect2info> <title>Parameters</title>
<date>1998-09-27</date>
</refsect2info>
<title>
Outputs
</title>
<para> <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> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>START TRANSACTION</computeroutput></term>
START TRANSACTION
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if successful. Message returned if successful.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>WARNING: BEGIN: already a transaction in progress</computeroutput></term>
WARNING: BEGIN: already a transaction in progress
</computeroutput></term>
<listitem> <listitem>
<para> <para>
If there is already a transaction in progress when the Message returned if there was already a transaction in progress
command is issued. when the command was issued.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
This command begins a new transaction. If the isolation level or
read/write mode is specified, the new transaction has those
characteristics, as if <xref linkend="sql-set-transaction"
endterm="sql-set-transaction-title"> was executed. In all other
respects, the behavior of this command is identical to the <xref
linkend="sql-begin" endterm="sql-begin-title"> command.
</para>
</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,30 +8,31 @@ PostgreSQL documentation ...@@ -8,30 +8,31 @@ 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>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<refsect2 id="R2-SQL-TRUNCATE-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Inputs
</title>
<para> <para>
<command>TRUNCATE</command> quickly removes all rows from a
table. It has the same effect as an unqualified
<command>DELETE</command> but since it does not actually scan the
table it is faster. This is most useful on large tables.
</para>
</refsect1>
<refsect1>
<title>Parameter</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
...@@ -43,78 +44,41 @@ TRUNCATE [ TABLE ] <replaceable class="PARAMETER">name</replaceable> ...@@ -43,78 +44,41 @@ TRUNCATE [ TABLE ] <replaceable class="PARAMETER">name</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect2 id="R2-SQL-TRUNCATE-2"> <refsect1>
<refsect2info> <title>Diagnostics</title>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>TRUNCATE TABLE</computeroutput></term>
TRUNCATE TABLE
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the table is successfully truncated. Message returned if the table was successfully truncated.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-TRUNCATE-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>TRUNCATE</command> quickly removes all rows from a
table. It has the same effect as an unqualified
<command>DELETE</command> but since it does not actually scan the
table it is faster. This is most useful on large tables.
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-TRUNCATE-2"> <refsect1>
<title> <title>Examples</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>
<refsect2 id="R2-SQL-TRUNCATE-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</title>
<para> <para>
There is no <command>TRUNCATE</command> in <acronym>SQL92</acronym>. There is no <command>TRUNCATE</command> command in the SQL standard.
</para> </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,136 +8,101 @@ PostgreSQL documentation ...@@ -8,136 +8,101 @@ 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> </refsynopsisdiv>
UNLISTEN { <replaceable class="PARAMETER">notifyname</replaceable> | * }
</synopsis> <refsect1>
<title>Description</title>
<refsect2 id="R2-SQL-UNLISTEN-1">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
Inputs
</title>
<para> <para>
<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>
<xref endterm="sql-notify-title" linkend="sql-notify">
contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">notifyname</replaceable></term> <term><replaceable class="PARAMETER">name</replaceable></term>
<listitem> <listitem>
<para> <para>
Name of previously registered notify condition. Name of a notification (any identifier).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><literal>*</literal></term> <term><literal>*</literal></term>
<listitem> <listitem>
<para> <para>
All current listen registrations for this backend are cleared. All current listen registrations for this session are cleared.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect1>
<refsect2 id="R2-SQL-UNLISTEN-2"> <title>Diagnostics</title>
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>UNLISTEN</computeroutput></term>
<returnvalue>UNLISTEN</returnvalue>
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Acknowledgment that statement has executed. Message returned when the command has executed.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-UNLISTEN-1">
<refsect1info>
<date>1998-10-19</date>
</refsect1info>
<title>
Description
</title>
<para> <refsect1>
<command>UNLISTEN</command> <title>Notes</title>
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.
</para>
<para> <para>
<xref endterm="sql-notify-title" linkend="sql-notify"> You unlisten something you were not listening for; no warning or error will appear.
contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para> </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> <para>
The backend does not complain if you unlisten something you were not At the end of each session, <command>UNLISTEN *</command> ist
listening for. automatically executed.
Each backend will automatically execute <command>UNLISTEN *</command> when
exiting.
</para> </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>
<refsect2 id="R2-SQL-UNLISTEN-4">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
SQL92
</title>
<para> <para>
There is no <command>UNLISTEN</command> in <acronym>SQL92</acronym>. There is no <command>UNLISTEN</command> command in the SQL standard.
</para> </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,50 +8,57 @@ PostgreSQL documentation ...@@ -8,50 +8,57 @@ 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>
</refsynopsisdiv>
<refsect2 id="R2-SQL-UPDATE-1">
<refsect2info> <refsect1>
<date>1998-09-24</date> <title>Description</title>
</refsect2info>
<title>
Inputs
</title>
<para> <para>
<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>
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>
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>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">table</replaceable></term> <term><replaceable class="PARAMETER">table</replaceable></term>
<listitem> <listitem>
<para> <para>
The name (optionally schema-qualified) of an existing table. If The name (optionally schema-qualified) of the table to update.
<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> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">column</replaceable></term> <term><replaceable class="PARAMETER">column</replaceable></term>
<listitem> <listitem>
...@@ -60,152 +67,77 @@ UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> SET <replacea ...@@ -60,152 +67,77 @@ UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> SET <replacea
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">expression</replaceable></term> <term><replaceable class="PARAMETER">expression</replaceable></term>
<listitem> <listitem>
<para> <para>
A valid expression or value to assign to column. An expression or value to assign to the column.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">fromlist</replaceable></term> <term><replaceable class="PARAMETER">fromlist</replaceable></term>
<listitem> <listitem>
<para> <para>
A <productname>PostgreSQL</productname> A list of table expressions, allowing columns from other tables
non-standard extension to allow columns to appear in the <literal>WHERE</> condition.
from other tables to appear in the WHERE condition.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">condition</replaceable></term> <term><replaceable class="PARAMETER">condition</replaceable></term>
<listitem> <listitem>
<para> <para>
Refer to the SELECT statement for a further description A value expression that returns a value of type
of the WHERE clause. <type>boolean</type> that determines the rows which are to be
updated.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect2 id="R2-SQL-UPDATE-2"> <refsect1>
<refsect2info> <title>Diagnostics</title>
<date>1998-09-24</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>UPDATE <replaceable class="parameter">count</replaceable></computeroutput></term>
UPDATE <replaceable class="parameter">#</replaceable>
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if successful. Message returned if successful. The value <replaceable
The <replaceable class="parameter">#</replaceable> class="parameter">count</replaceable> is the number of rows
means the number of rows updated. updated. If <replaceable class="parameter">count</replaceable>
If <replaceable class="parameter">#</replaceable> is 0, no rows were updated.
is 0 no rows are updated.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-UPDATE-1">
<refsect1info>
<date>1998-09-24</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>UPDATE</command> changes the values of the columns specified for
all rows which satisfy condition. Only the columns
to be modified need appear as columns in the statement.
</para>
<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.
</para>
<para>
You must have write access to the table in order to modify
it, as well as read access to any table whose values are
mentioned in the WHERE condition.
</para>
<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.
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-UPDATE-2"> <refsect1>
<title> <title>Examples</title>
Usage
</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>
<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> <para>
identifies an open cursor. This command conforms to the SQL standard. The
<literal>FROM</literal> clause is a PostgreSQL extension.
</para> </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