1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v 1.63 2003/03/25 16: 15:39 petere Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v 1.64 2003/04/14 15:24:46 tgl Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -826,24 +826,32 @@ CREATE TABLE distributors (
826
826
<title>Temporary Tables</title>
827
827
828
828
<para>
829
- In addition to the local temporary table, SQL92 also defines a
830
- <literal>CREATE GLOBAL TEMPORARY TABLE</literal> statement.
831
- Global temporary tables are also visible to other sessions.
829
+ Although the syntax of <literal>CREATE TEMPORARY TABLE</literal>
830
+ resembles that of SQL92, the effect is not the same. In the standard,
831
+ temporary tables are associated with modules; a temporary table is created
832
+ just once and automatically exists (starting with empty contents) in every
833
+ session that uses the module.
834
+ <productname>PostgreSQL</productname> does not have modules, and
835
+ requires each session to issue its own <literal>CREATE TEMPORARY
836
+ TABLE</literal> command for each temporary table to be used.
832
837
</para>
833
838
834
- <para>
835
- For temporary tables, there is an optional <literal>ON COMMIT</literal> clause:
836
- <synopsis>
837
- CREATE { GLOBAL | LOCAL } TEMPORARY TABLE <replaceable class="parameter">table</replaceable> ( <replaceable class="parameter">...</replaceable> ) [ ON COMMIT { DELETE | PRESERVE } ROWS ]
838
- </synopsis>
839
+ <note>
840
+ <para>
841
+ The spec-mandated behavior of temporary tables is widely ignored.
842
+ <productname>PostgreSQL</productname>'s behavior on this point is similar
843
+ to that of several other RDBMSs.
844
+ </para>
845
+ </note>
839
846
840
- The <literal>ON COMMIT</literal> clause specifies whether or not
841
- the temporary table should be emptied of rows whenever
842
- <command>COMMIT</command> is executed. If the <literal>ON
843
- COMMIT</> clause is omitted, SQL92 specifies that the default is
844
- <literal>ON COMMIT DELETE ROWS</>. However, the behavior of
845
- <productname>PostgreSQL</productname> is always like <literal>ON
846
- COMMIT PRESERVE ROWS</literal>.
847
+ <para>
848
+ The optional <literal>ON COMMIT</literal> clause for temporary tables
849
+ also resembles SQL92, but has some differences.
850
+ If the <literal>ON COMMIT</> clause is omitted, SQL92 specifies that the
851
+ default behavior is <literal>ON COMMIT DELETE ROWS</>. However, the
852
+ default behavior in <productname>PostgreSQL</productname> is
853
+ <literal>ON COMMIT PRESERVE ROWS</literal>. The <literal>ON COMMIT
854
+ DROP</literal> option does not exist in SQL92 at all.
847
855
</para>
848
856
</refsect2>
849
857
@@ -854,7 +862,7 @@ CREATE { GLOBAL | LOCAL } TEMPORARY TABLE <replaceable class="parameter">table</
854
862
The <literal>NULL</> <quote>constraint</quote> (actually a
855
863
non-constraint) is a <productname>PostgreSQL</productname>
856
864
extension to SQL92 that is included for compatibility with some
857
- otherRDBMS (and for symmetry with the <literal>NOT
865
+ otherRDBMSs (and for symmetry with the <literal>NOT
858
866
NULL</literal> constraint). Since it is the default for any
859
867
column, its presence is simply noise.
860
868
</para>