From ebb531836ada81958bbf95c60dd05dc58eb3e810 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 9 Nov 2002 23:56:39 +0000 Subject: Add code to handle [ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP }] for temp tables. Gavin Sherry --- doc/src/sgml/ref/create_table.sgml | 60 +++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 7 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 9e9525775c7..274b6f8c518 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -1,5 +1,5 @@ @@ -21,7 +21,7 @@ CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE t | table_constraint } [, ... ] ) [ INHERITS ( parent_table [, ... ] ) ] -[ WITH OIDS | WITHOUT OIDS ] +[ WITH OIDS | WITHOUT OIDS ] [ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ] where column_constraint is: @@ -107,10 +107,11 @@ and table_constraint is: 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. @@ -487,9 +488,54 @@ and table_constraint is: - + + ON COMMIT + + + The behaviour of temporary tables at the end of a transaction + block can be controlled using ON COMMIT. + 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. + + + The three parameters to ON COMMIT are: + + + + PRESERVE ROWS + + + The rows in the temporary table will persist after the + transaction block. + + + + + + DELETE ROWS + + + All rows in the temporary table will be deleted at the + end of the transaction block. + + + + + DROP + + + The temporary table will be dropped at the end of the transaction. + + + + + + + + -- cgit v1.2.3