Clarify description of our deviation from standard for temp tables,
authorTom Lane
Mon, 14 Apr 2003 15:24:46 +0000 (15:24 +0000)
committerTom Lane
Mon, 14 Apr 2003 15:24:46 +0000 (15:24 +0000)
per suggestion from Mike Sykes.

doc/src/sgml/ref/create_table.sgml

index c693c0ae6f55574f778f9f40c3b0582432e1b29c..7c407d630b9e3c19b4200a3004eb99fc0331f048 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -826,24 +826,32 @@ CREATE TABLE distributors (
    Temporary Tables
 
    
-    In addition to the local temporary table, SQL92 also defines a
-    CREATE GLOBAL TEMPORARY TABLE statement.
-    Global temporary tables are also visible to other sessions.
+    Although the syntax of CREATE TEMPORARY TABLE
+    resembles that of SQL92, the effect is not the same.  In the standard,
+    temporary tables are associated with modules; a temporary table is created
+    just once and automatically exists (starting with empty contents) in every
+    session that uses the module.
+    PostgreSQL does not have modules, and
+    requires each session to issue its own CREATE TEMPORARY
+    TABLE command for each temporary table to be used.
    
 
-   
-    For temporary tables, there is an optional ON COMMIT clause:
-
-CREATE { GLOBAL | LOCAL } TEMPORARY TABLE table ( ... ) [ ON COMMIT { DELETE | PRESERVE } ROWS ] 
-
+   
+    
+     The spec-mandated behavior of temporary tables is widely ignored.
+     PostgreSQL's behavior on this point is similar
+     to that of several other RDBMSs.
+    
+   
 
-    The ON COMMIT clause specifies whether or not
-    the temporary table should be emptied of rows whenever
-    COMMIT is executed. If the ON
-    COMMIT clause is omitted, SQL92 specifies that the default is
-    ON COMMIT DELETE ROWS.  However, the behavior of
-    PostgreSQL is always like ON
-    COMMIT PRESERVE ROWS.
+   
+    The optional ON COMMIT clause for temporary tables
+    also resembles SQL92, but has some differences.
+    If the ON COMMIT clause is omitted, SQL92 specifies that the
+    default behavior is ON COMMIT DELETE ROWS.  However, the
+    default behavior in PostgreSQL is
+    ON COMMIT PRESERVE ROWS.  The ON COMMIT
+    DROP option does not exist in SQL92 at all.
    
   
 
@@ -854,7 +862,7 @@ CREATE { GLOBAL | LOCAL } TEMPORARY TABLE table
     The NULL constraint (actually a
     non-constraint) is a PostgreSQL
     extension to SQL92 that is included for compatibility with some
-    other RDBMS (and for symmetry with the NOT
+    other RDBMSs (and for symmetry with the NOT
     NULL constraint).  Since it is the default for any
     column, its presence is simply noise.