mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Add code to handle [ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP }]
for temp tables. Gavin Sherry
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v 1.56 2002/09/02 06:20:53 momjian Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v 1.57 2002/11/09 23:56:38 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -21,7 +21,7 @@ CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable class="PARAMETER">t
|
||||
| <replaceable>table_constraint</replaceable> } [, ... ]
|
||||
)
|
||||
[ INHERITS ( <replaceable>parent_table</replaceable> [, ... ] ) ]
|
||||
[ WITH OIDS | WITHOUT OIDS ]
|
||||
[ WITH OIDS | WITHOUT OIDS ] [ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
|
||||
|
||||
where <replaceable class="PARAMETER">column_constraint</replaceable> is:
|
||||
|
||||
@ -107,10 +107,11 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is:
|
||||
<para>
|
||||
If specified, the table is created as a temporary table.
|
||||
Temporary tables are automatically dropped at the end of a
|
||||
session. Existing permanent tables with the same name are not
|
||||
visible to the current session while the temporary table exists,
|
||||
unless they are referenced with schema-qualified names.
|
||||
Any indexes created on a temporary table are automatically
|
||||
session or optionally at the end of the current transaction
|
||||
(See ON COMMIT below). Existing permanent tables with the same
|
||||
name are not visible to the current session while the temporary
|
||||
table exists, unless they are referenced with schema-qualified
|
||||
names. Any indexes created on a temporary table are automatically
|
||||
temporary as well.
|
||||
</para>
|
||||
|
||||
@ -487,9 +488,54 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is:
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>ON COMMIT</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The behaviour of temporary tables at the end of a transaction
|
||||
block can be controlled using <literal>ON COMMIT</literal>.
|
||||
The table will exhibit the same behavior at the end of
|
||||
transaction blocks for the duration of the session unless
|
||||
ON COMMIT DROP is specified or the temporary table is dropped.
|
||||
</para>
|
||||
<para>
|
||||
The three parameters to ON COMMIT are:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>PRESERVE ROWS</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The rows in the temporary table will persist after the
|
||||
transaction block.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>DELETE ROWS</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
All rows in the temporary table will be deleted at the
|
||||
end of the transaction block.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>DROP</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The temporary table will be dropped at the end of the transaction.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
|
||||
</refsect1>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user