Index: doc/src/sgml/ref/create_table_as.sgml =================================================================== RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/create_table_as.sgml,v retrieving revision 1.31 diff -c -r1.31 create_table_as.sgml *** doc/src/sgml/ref/create_table_as.sgml 1 Nov 2005 21:09:50 -0000 1.31 --- doc/src/sgml/ref/create_table_as.sgml 14 Feb 2006 21:07:27 -0000 *************** *** 21,27 **** CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ! [ (column_name [, ...] ) ] [ [ WITH | WITHOUT ] OIDS ] AS query --- 21,30 ---- CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ! [ (column_name [, ...] ) ] ! [ WITH OIDS | WITHOUT OIDS ] ! [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ] ! [ TABLESPACE tablespace ] AS query *************** *** 114,119 **** --- 117,180 ---- + ON COMMIT + + + The behavior of temporary tables at the end of a transaction + block can be controlled using ON COMMIT. + The three options are: + + + + PRESERVE ROWS + + + No special action is taken at the ends of transactions. + This is the default behavior. + + + + + + DELETE ROWS + + + All rows in the temporary table will be deleted at the + end of each transaction block. Essentially, an automatic + is done at each commit. + + + + + + DROP + + + The temporary table will be dropped at the end of the current + transaction block. + + + + + + + + + + TABLESPACE tablespace + + + The tablespace is the name + of the tablespace in which the new table is to be created. + If not specified, + is used, or the database's + default tablespace if default_tablespace is an empty + string. + + + + + query *************** *** 170,175 **** --- 231,250 ---- SELECT * FROM films WHERE date_prod >= '2002-01-01'; + + + Create a new temporary table that will be dropped at commit + films_recent with oids consisting of only + recent entries from the table films using a + prepared statement: + + + PREPARE recentfilms(date) AS + SELECT * FROM films WHERE date_prod > $1; + CREATE TEMP TABLE films_recent WITH OIDS ON COMMIT DROP AS + EXECUTE recentfilms('2002-01-01'); + + *************** *** 190,202 **** - The standard defines an ON COMMIT clause; - this is not currently implemented by PostgreSQL. - - - - - The standard defines a WITH [ NO ] DATA clause; this is not currently implemented by PostgreSQL. The behavior provided by PostgreSQL is equivalent --- 265,270 ---- *************** *** 219,224 **** --- 287,300 ---- for details. + + + + The PostgreSQL concept of tablespaces is not + part of the standard. Hence, the clause TABLESPACE + is an extension. + +