Skip to content

Commit 169fb2d

Browse files
author
Commitfest Bot
committed
[CF 5547] v2 - Doc: Create table improvements
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5547 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/[email protected] Author(s): David Johnston
2 parents f727b63 + 026cd55 commit 169fb2d

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

doc/src/sgml/ref/create_table.sgml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ PostgreSQL documentation
2121

2222
<refsynopsisdiv>
2323
<synopsis>
24-
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] <replaceable class="parameter">table_name</replaceable> ( [
25-
{ <replaceable class="parameter">column_name</replaceable> <replaceable class="parameter">data_type</replaceable> [ STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT } ] [ COMPRESSION <replaceable>compression_method</replaceable> ] [ COLLATE <replaceable>collation</replaceable> ] [ <replaceable class="parameter">column_constraint</replaceable> [ ... ] ]
24+
CREATE [ <replaceable>persistence_mode</replaceable> ] TABLE [ IF NOT EXISTS ] <replaceable class="parameter">table_name</replaceable> ( [
25+
{ <replaceable class="parameter">column_name</replaceable> <replaceable class="parameter">data_type</replaceable> [ <replaceable>oversize_storage</replaceable> ] [ COLLATE <replaceable>collation</replaceable> ] [ <replaceable class="parameter">column_constraint</replaceable> [ ... ] ]
2626
| <replaceable>table_constraint</replaceable>
2727
| LIKE <replaceable>source_table</replaceable> [ <replaceable>like_option</replaceable> ... ] }
2828
[, ... ]
@@ -34,7 +34,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
3434
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
3535
[ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
3636

37-
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] <replaceable class="parameter">table_name</replaceable>
37+
CREATE [ <replaceable>persistence_mode</replaceable> ] TABLE [ IF NOT EXISTS ] <replaceable class="parameter">table_name</replaceable>
3838
OF <replaceable class="parameter">type_name</replaceable> [ (
3939
{ <replaceable class="parameter">column_name</replaceable> [ WITH OPTIONS ] [ <replaceable class="parameter">column_constraint</replaceable> [ ... ] ]
4040
| <replaceable>table_constraint</replaceable> }
@@ -46,7 +46,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
4646
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
4747
[ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
4848

49-
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] <replaceable class="parameter">table_name</replaceable>
49+
CREATE [ <replaceable>persistence_mode</replaceable> ] TABLE [ IF NOT EXISTS ] <replaceable class="parameter">table_name</replaceable>
5050
PARTITION OF <replaceable class="parameter">parent_table</replaceable> [ (
5151
{ <replaceable class="parameter">column_name</replaceable> [ WITH OPTIONS ] [ <replaceable class="parameter">column_constraint</replaceable> [ ... ] ]
5252
| <replaceable>table_constraint</replaceable> }
@@ -58,7 +58,16 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
5858
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
5959
[ TABLESPACE <replaceable class="parameter">tablespace_name</replaceable> ]
6060

61-
<phrase>where <replaceable class="parameter">column_constraint</replaceable> is:</phrase>
61+
<phrase>where <replaceable>persistence_mode</replaceable> is: </phrase>
62+
63+
[ GLOBAL | LOCAL ] { TEMPORARY | TEMP } |
64+
UNLOGGED
65+
66+
<phrase>and <replaceable>oversize_storage</replaceable> is:</phrase>
67+
68+
STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT } [ COMPRESSION <replaceable>compression_method</replaceable> ]
69+
70+
<phrase>and <replaceable class="parameter">column_constraint</replaceable> is:</phrase>
6271

6372
[ CONSTRAINT <replaceable class="parameter">constraint_name</replaceable> ]
6473
{ NOT NULL [ NO INHERIT ] |
@@ -123,6 +132,14 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
123132
command.
124133
</para>
125134

135+
<para>
136+
The durability characteristics of a table are governed by its persistence
137+
mode. If none is specified, the data will be persistent and crash-safe.
138+
For less stringent requirements and better performance, a table can be
139+
specified as <link linkend="sql-createtable-temporary">temporary</link>
140+
or <link linkend="sql-createtable-unlogged">unlogged</link>.
141+
</para>
142+
126143
<para>
127144
If a schema name is given (for example, <literal>CREATE TABLE
128145
myschema.mytable ...</literal>) then the table is created in the specified

0 commit comments

Comments
 (0)