Skip to content

Commit ff02d0a

Browse files
author
Neil Conway
committed
Make default_with_oids default to false -- user-created tables will now
no longer include OIDs, unless WITH OIDS is specified or the default_with_oids configuration parameter is enabled. Update the docs accordingly.
1 parent 0edc2f1 commit ff02d0a

File tree

8 files changed

+48
-70
lines changed

8 files changed

+48
-70
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.155 2005/01/22 22:56:35 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.156 2005/03/13 09:36:30 neilc Exp $
33
-->
44

55
<chapter id="datatype">
@@ -2980,12 +2980,12 @@ SELECT * FROM test;
29802980
<para>
29812981
Object identifiers (OIDs) are used internally by
29822982
<productname>PostgreSQL</productname> as primary keys for various
2983-
system tables. An OID system column is also added to user-created
2984-
tables, unless <literal>WITHOUT OIDS</literal> is specified when
2985-
the table is created, or the <xref linkend="guc-default-with-oids">
2986-
configuration variable is set to false. Type <type>oid</>
2987-
represents an object identifier. There are also several alias
2988-
types for <type>oid</>: <type>regproc</>, <type>regprocedure</>,
2983+
system tables. OIDs are not added to user-created tables, unless
2984+
<literal>WITH OIDS</literal> is specified when the table is
2985+
created, or the <xref linkend="guc-default-with-oids">
2986+
configuration variable is enabled. Type <type>oid</> represents
2987+
an object identifier. There are also several alias types for
2988+
<type>oid</>: <type>regproc</>, <type>regprocedure</>,
29892989
<type>regoper</>, <type>regoperator</>, <type>regclass</>, and
29902990
<type>regtype</>. <xref linkend="datatype-oid-table"> shows an
29912991
overview.
@@ -3000,28 +3000,11 @@ SELECT * FROM test;
30003000
references to system tables.
30013001
</para>
30023002

3003-
<note>
3004-
<para>
3005-
OIDs are included by default in user-created tables in
3006-
<productname>PostgreSQL</productname> &version;. However, this
3007-
behavior is likely to change in a future version of
3008-
<productname>PostgreSQL</productname>. Eventually, user-created
3009-
tables will not include an OID system column unless <literal>WITH
3010-
OIDS</literal> is specified when the table is created, or the
3011-
<varname>default_with_oids</varname> configuration variable is set
3012-
to true. If your application requires the presence of an OID
3013-
system column in a table, it should specify <literal>WITH
3014-
OIDS</literal> when that table is created to ensure compatibility
3015-
with future releases of <productname>PostgreSQL</productname>.
3016-
</para>
3017-
</note>
3018-
30193003
<para>
30203004
The <type>oid</> type itself has few operations beyond comparison.
3021-
It can be cast to
3022-
integer, however, and then manipulated using the standard integer
3023-
operators. (Beware of possible signed-versus-unsigned confusion
3024-
if you do this.)
3005+
It can be cast to integer, however, and then manipulated using the
3006+
standard integer operators. (Beware of possible
3007+
signed-versus-unsigned confusion if you do this.)
30253008
</para>
30263009

30273010
<para>

doc/src/sgml/ddl.sgml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/ddl.sgml,v 1.39 2005/01/22 22:56:35 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/ddl.sgml,v 1.40 2005/03/13 09:36:30 neilc Exp $ -->
22

33
<chapter id="ddl">
44
<title>Data Definition</title>
@@ -868,11 +868,10 @@ CREATE TABLE order_items (
868868
<primary>OID</primary>
869869
<secondary>column</secondary>
870870
</indexterm>
871-
The object identifier (object ID) of a row. This is a serial
872-
number that is automatically added by
873-
<productname>PostgreSQL</productname> to all table rows (unless
874-
the table was created using <literal>WITHOUT OIDS</literal>, in which
875-
case this column is not present). This column is of type
871+
The object identifier (object ID) of a row. This column is only
872+
present if the table was created using <literal>WITH
873+
OIDS</literal>, or if the <xref linkend="guc-default-with-oids">
874+
configuration variable was enabled. This column is of type
876875
<type>oid</type> (same name as the column); see <xref
877876
linkend="datatype-oid"> for more information about the type.
878877
</para>

doc/src/sgml/plpgsql.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.61 2005/02/14 00:54:26 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.62 2005/03/13 09:36:30 neilc Exp $
33
-->
44

55
<chapter id="plpgsql">
@@ -1299,7 +1299,8 @@ GET DIAGNOSTICS <replaceable>variable</replaceable> = <replaceable>item</replace
12991299
the <acronym>SQL</acronym> engine, and <varname>RESULT_OID</>,
13001300
the OID of the last row inserted by the most recent
13011301
<acronym>SQL</acronym> command. Note that <varname>RESULT_OID</>
1302-
is only useful after an <command>INSERT</command> command.
1302+
is only useful after an <command>INSERT</command> command into a
1303+
table containing OIDs.
13031304
</para>
13041305

13051306
<para>

doc/src/sgml/pltcl.sgml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/pltcl.sgml,v 2.34 2005/01/22 22:56:36 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/pltcl.sgml,v 2.35 2005/03/13 09:36:30 neilc Exp $
33
-->
44

55
<chapter id="pltcl">
@@ -400,8 +400,9 @@ $$ LANGUAGE pltcl;
400400
<listitem>
401401
<para>
402402
Returns the OID of the row inserted by the last
403-
<function>spi_exec</> or <function>spi_execp</>,
404-
if the command was a single-row <command>INSERT</>. (If not, you get zero.)
403+
<function>spi_exec</> or <function>spi_execp</>, if the
404+
command was a single-row <command>INSERT</> and the modified
405+
table contained OIDs. (If not, you get zero.)
405406
</para>
406407
</listitem>
407408
</varlistentry>

doc/src/sgml/ref/select_into.sgml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/select_into.sgml,v 1.33 2005/01/09 05:57:45 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/select_into.sgml,v 1.34 2005/03/13 09:36:31 neilc Exp $
33
PostgreSQL documentation
44
-->
55

@@ -94,14 +94,13 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="PARAMETER">expression</replac
9494
</para>
9595

9696
<para>
97-
Prior to <productname>PostgreSQL</> 8.0, the table created by
98-
<command>SELECT INTO</command> always included OIDs.
99-
As of <productname>PostgreSQL</> 8.0, the
100-
inclusion of OIDs in the table created by <command>SELECT
101-
INTO</command> is controlled by the
102-
<xref linkend="guc-default-with-oids"> configuration variable. This
103-
variable currently defaults to true, but will likely default to
104-
false in a future release of <productname>PostgreSQL</>.
97+
Prior to <productname>PostgreSQL</> 8.1, the table created by
98+
<command>SELECT INTO</command> included OIDs by default. In
99+
<productname>PostgreSQL</productname> 8.1, this is not the case
100+
&mdash; to include OIDs in the new table, the <xref
101+
linkend="guc-default-with-oids"> configuration variable must be
102+
enabled. Alternatively, <command>CREATE TABLE AS</command> can be
103+
used with the <literal>WITH OIDS</literal> clause.
105104
</para>
106105
</refsect1>
107106

doc/src/sgml/runtime.sgml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.307 2005/03/04 20:21:05 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.308 2005/03/13 09:36:30 neilc Exp $
33
-->
44

55
<chapter Id="runtime">
@@ -3587,23 +3587,18 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
35873587
newly-created tables, if neither <literal>WITH OIDS</literal>
35883588
nor <literal>WITHOUT OIDS</literal> is specified. It also
35893589
determines whether OIDs will be included in tables created by
3590-
<command>SELECT INTO</command>. In
3591-
<productname>PostgreSQL</productname> &version;
3592-
<varname>default_with_oids</varname> defaults to true. This is
3593-
also the behavior of previous versions of
3594-
<productname>PostgreSQL</productname>. However, assuming that
3595-
tables will contain OIDs by default is not encouraged. This
3596-
option will probably default to false in a future release of
3597-
<productname>PostgreSQL</productname>.
3598-
</para>
3599-
3600-
<para>
3601-
To ease compatibility with applications that make use of OIDs,
3602-
this option should left enabled. To ease compatibility with
3603-
future versions of <productname>PostgreSQL</productname>, this
3604-
option should be disabled, and applications that require OIDs
3605-
on certain tables should explicitly specify <literal>WITH
3606-
OIDS</literal> when those tables are created.
3590+
<command>SELECT INTO</command>. In <productname>PostgreSQL</>
3591+
8.1 <varname>default_with_oids</> is disabled by default; in
3592+
prior versions of PostgreSQL, it was true by default.
3593+
</para>
3594+
3595+
<para>
3596+
The use of OIDs in user tables is considered deprecated, so
3597+
most installations should leave this variable disabled.
3598+
Applications that require OIDs for a particular table should
3599+
specify <literal>WITH OIDS</literal> when creating the
3600+
table. This variable can be enabled for compatibility with old
3601+
applications that do not follow this behavior.
36073602
</para>
36083603
</listitem>
36093604
</varlistentry>

src/backend/utils/misc/guc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.254 2005/03/04 20:21:06 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.255 2005/03/13 09:36:31 neilc Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -139,7 +139,7 @@ bool Australian_timezones = false;
139139

140140
bool Password_encryption = true;
141141

142-
bool default_with_oids = true;
142+
bool default_with_oids = false;
143143

144144
int log_min_error_statement = PANIC;
145145
int log_min_messages = NOTICE;
@@ -801,11 +801,11 @@ static struct config_bool ConfigureNamesBool[] =
801801
},
802802
{
803803
{"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
804-
gettext_noop("By default, newly-created tables should have OIDs."),
804+
gettext_noop("Create new tables with OIDs by default."),
805805
NULL
806806
},
807807
&default_with_oids,
808-
true, NULL, NULL
808+
false, NULL, NULL
809809
},
810810
{
811811
{"redirect_stderr", PGC_POSTMASTER, LOGGING_WHERE,

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@
314314
#add_missing_from = true
315315
#regex_flavor = advanced # advanced, extended, or basic
316316
#sql_inheritance = true
317-
#default_with_oids = true
317+
#default_with_oids = false
318318

319319
# - Other Platforms & Clients -
320320

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy