1
1
<!--
2
- $PostgreSQL: pgsql/doc/src/sgml/ref/create_table_as.sgml,v 1.19 2003/12/13 23:59:07 neilc Exp $
2
+ $PostgreSQL: pgsql/doc/src/sgml/ref/create_table_as.sgml,v 1.20 2004/01/10 23:28:44 neilc Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -20,7 +20,7 @@ PostgreSQL documentation
20
20
21
21
<refsynopsisdiv>
22
22
<synopsis>
23
- CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replaceable> [ (<replaceable>column_name</replaceable> [, ...] ) ]
23
+ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replaceable> [ (<replaceable>column_name</replaceable> [, ...] ) ] [ [ WITH | WITHOUT ] OIDS ]
24
24
AS <replaceable>query</replaceable>
25
25
</synopsis>
26
26
</refsynopsisdiv>
@@ -98,6 +98,20 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name
98
98
</listitem>
99
99
</varlistentry>
100
100
101
+ <varlistentry>
102
+ <term><literal>WITH OIDS</literal></term>
103
+ <term><literal>WITHOUT OIDS</literal></term>
104
+ <listitem>
105
+ <para>
106
+ This optional clause specifies whether the table created by
107
+ <command>CREATE TABLE AS</command> should include OIDs. If
108
+ neither form of this clause if specified, the value of the
109
+ <varname>default_with_oids</varname> configuration parameter is
110
+ used.
111
+ </para>
112
+ </listitem>
113
+ </varlistentry>
114
+
101
115
<varlistentry>
102
116
<term><replaceable>query</replaceable></term>
103
117
<listitem>
@@ -121,23 +135,30 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name
121
135
This command is functionally similar to <xref
122
136
linkend="sql-selectinto" endterm="sql-selectinto-title">, but it is
123
137
preferred since it is less likely to be confused with other uses of
124
- the <command>SELECT INTO</command> syntax.
138
+ the <command>SELECT INTO</> syntax. Furthermore, <command>CREATE
139
+ TABLE AS</command> offers a superset of the functionality offerred
140
+ by <command>SELECT INTO</command>.
125
141
</para>
126
142
127
143
<para>
128
- Prior to <productname>PostgreSQL</> 7.5, <command>CREATE TABLE
129
- AS</command> always included OIDs in the table it
144
+ Prior to <productname>PostgreSQL</productname > 7.5, <command>CREATE
145
+ TABLE AS</command> always included OIDs in the table it
130
146
produced. Furthermore, these OIDs were newly generated: they were
131
147
distinct from the OIDs of any of the rows in the source tables of
132
148
the <command>SELECT</command> or <command>EXECUTE</command>
133
149
statement. Therefore, if <command>CREATE TABLE AS</command> was
134
150
frequently executed, the OID counter would be rapidly
135
- incremented. As of <productname>PostgreSQL</> 7.5, the inclusion of
136
- OIDs in the table generated by <command>CREATE TABLE AS</command>
137
- is controlled by the <varname>default_with_oids</varname>
138
- configuration variable. This variable currently defaults to true,
139
- but will likely default to false in a future release of
140
- <productname>PostgreSQL</>.
151
+ incremented. As of <productname>PostgresSQL</productname> 7.5,
152
+ the <command>CREATE TABLE AS</command> command allows the user to
153
+ explicitely specify whether OIDs should be included. If the
154
+ presence of OIDs is not explicitely specified,
155
+ the <varname>default_with_oids</varname> configuration variable is
156
+ used. While this variable currently defaults to true, the default
157
+ value may be changed in the future. Therefore, applications that
158
+ require OIDs in the table created by <command>CREATE TABLE
159
+ AS</command> should explicitely specify <literal>WITH
160
+ OIDS</literal> to ensure compatibility with future versions
161
+ of <productname>PostgreSQL</productname>.
141
162
</para>
142
163
</refsect1>
143
164
0 commit comments