Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d99dbb

Browse files
committed
Clarify description of our deviation from standard for temp tables,
per suggestion from Mike Sykes.
1 parent810e0b9 commit6d99dbb

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

‎doc/src/sgml/ref/create_table.sgml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
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/1415:24:46 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -826,24 +826,32 @@ CREATE TABLE distributors (
826826
<title>Temporary Tables</title>
827827

828828
<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.
832837
</para>
833838

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>
839846

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.
847855
</para>
848856
</refsect2>
849857

@@ -854,7 +862,7 @@ CREATE { GLOBAL | LOCAL } TEMPORARY TABLE <replaceable class="parameter">table</
854862
The <literal>NULL</> <quote>constraint</quote> (actually a
855863
non-constraint) is a <productname>PostgreSQL</productname>
856864
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
858866
NULL</literal> constraint). Since it is the default for any
859867
column, its presence is simply noise.
860868
</para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp