Skip site navigation (1) Skip section navigation (2)

Re: default to WITHOUT OIDS

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: default to WITHOUT OIDS
Date: 2005-03-12 06:24:44
Message-ID: d0u27u$ns4$1@news.hub.org (view raw or flat)
Thread:
Lists: pgsql-patches
!    gettext_noop("Create new tables with OIDs by default."),
without?



"Neil Conway" <neilc(at)samurai(dot)com>
> This patch makes default_with_oids disabled by default, per earlier
> discussion, and updates the documentation accordingly. I might have
> missed a few spots in the documentation that implicitly assume that OIDs
> are present in user tables by default, but I think I got most of them.
>
> Barring any objections, I'll apply this on Monday.
>
> -Neil
>


----------------------------------------------------------------------------
----


> Index: doc/src/sgml/datatype.sgml
> ===================================================================
> RCS file: /var/lib/cvs/pgsql/doc/src/sgml/datatype.sgml,v
> retrieving revision 1.155
> diff -c -r1.155 datatype.sgml
> *** doc/src/sgml/datatype.sgml 22 Jan 2005 22:56:35 -0000 1.155
> --- doc/src/sgml/datatype.sgml 11 Mar 2005 05:35:45 -0000
> ***************
> *** 2980,2989 ****
>      <para>
>       Object identifiers (OIDs) are used internally by
>       <productname>PostgreSQL</productname> as primary keys for various
> !     system tables.  An OID system column is also added to user-created
> !     tables, unless <literal>WITHOUT OIDS</literal> is specified when
> !     the table is created, or the <xref linkend="guc-default-with-oids">
> !     configuration variable is set to false.  Type <type>oid</>
>       represents an object identifier.  There are also several alias
>       types for <type>oid</>: <type>regproc</>, <type>regprocedure</>,
>       <type>regoper</>, <type>regoperator</>, <type>regclass</>, and
> --- 2980,2989 ----
>      <para>
>       Object identifiers (OIDs) are used internally by
>       <productname>PostgreSQL</productname> as primary keys for various
> !     system tables.  OIDs are not added to user-created tables, unless
> !     <literal>WITH OIDS</literal> is specified when the table is
> !     created, or the <xref linkend="guc-default-with-oids">
> !     configuration variable is set to true.  Type <type>oid</>
>       represents an object identifier.  There are also several alias
>       types for <type>oid</>: <type>regproc</>, <type>regprocedure</>,
>       <type>regoper</>, <type>regoperator</>, <type>regclass</>, and
> ***************
> *** 3000,3027 ****
>       references to system tables.
>      </para>
>
> -    <note>
> -     <para>
> -      OIDs are included by default in user-created tables in
> -      <productname>PostgreSQL</productname> &version;. However, this
> -      behavior is likely to change in a future version of
> -      <productname>PostgreSQL</productname>. Eventually, user-created
> -      tables will not include an OID system column unless <literal>WITH
> -      OIDS</literal> is specified when the table is created, or the
> -      <varname>default_with_oids</varname> configuration variable is set
> -      to true. If your application requires the presence of an OID
> -      system column in a table, it should specify <literal>WITH
> -      OIDS</literal> when that table is created to ensure compatibility
> -      with future releases of <productname>PostgreSQL</productname>.
> -     </para>
> -    </note>
> -
>      <para>
>       The <type>oid</> type itself has few operations beyond comparison.
> !     It can be cast to
> !     integer, however, and then manipulated using the standard integer
> !     operators.  (Beware of possible signed-versus-unsigned confusion
> !     if you do this.)
>      </para>
>
>      <para>
> --- 3000,3010 ----
>       references to system tables.
>      </para>
>
>      <para>
>       The <type>oid</> type itself has few operations beyond comparison.
> !     It can be cast to integer, however, and then manipulated using the
> !     standard integer operators.  (Beware of possible
> !     signed-versus-unsigned confusion if you do this.)
>      </para>
>
>      <para>
> Index: doc/src/sgml/ddl.sgml
> ===================================================================
> RCS file: /var/lib/cvs/pgsql/doc/src/sgml/ddl.sgml,v
> retrieving revision 1.39
> diff -c -r1.39 ddl.sgml
> *** doc/src/sgml/ddl.sgml 22 Jan 2005 22:56:35 -0000 1.39
> --- doc/src/sgml/ddl.sgml 11 Mar 2005 05:41:25 -0000
> ***************
> *** 868,878 ****
>          <primary>OID</primary>
>          <secondary>column</secondary>
>         </indexterm>
> !       The object identifier (object ID) of a row.  This is a serial
> !       number that is automatically added by
> !       <productname>PostgreSQL</productname> to all table rows (unless
> !       the table was created using <literal>WITHOUT OIDS</literal>, in
which
> !       case this column is not present).  This column is of type
>         <type>oid</type> (same name as the column); see <xref
>         linkend="datatype-oid"> for more information about the type.
>        </para>
> --- 868,877 ----
>          <primary>OID</primary>
>          <secondary>column</secondary>
>         </indexterm>
> !       The object identifier (object ID) of a row. This column is only
> !       present if the table was created using <literal>WITH
> !       OIDS</literal>, or if the <xref linkend="guc-default-with-oids">
> !       configuration variable was enabled. This column is of type
>         <type>oid</type> (same name as the column); see <xref
>         linkend="datatype-oid"> for more information about the type.
>        </para>
> Index: doc/src/sgml/plpgsql.sgml
> ===================================================================
> RCS file: /var/lib/cvs/pgsql/doc/src/sgml/plpgsql.sgml,v
> retrieving revision 1.61
> diff -c -r1.61 plpgsql.sgml
> *** doc/src/sgml/plpgsql.sgml 14 Feb 2005 00:54:26 -0000 1.61
> --- doc/src/sgml/plpgsql.sgml 11 Mar 2005 05:47:32 -0000
> ***************
> *** 1299,1305 ****
>        the <acronym>SQL</acronym> engine, and <varname>RESULT_OID</>,
>        the OID of the last row inserted by the most recent
>        <acronym>SQL</acronym> command.  Note that <varname>RESULT_OID</>
> !      is only useful after an <command>INSERT</command> command.
>       </para>
>
>       <para>
> --- 1299,1306 ----
>        the <acronym>SQL</acronym> engine, and <varname>RESULT_OID</>,
>        the OID of the last row inserted by the most recent
>        <acronym>SQL</acronym> command.  Note that <varname>RESULT_OID</>
> !      is only useful after an <command>INSERT</command> command into a
> !      table containing OIDs.
>       </para>
>
>       <para>
> Index: doc/src/sgml/pltcl.sgml
> ===================================================================
> RCS file: /var/lib/cvs/pgsql/doc/src/sgml/pltcl.sgml,v
> retrieving revision 2.34
> diff -c -r2.34 pltcl.sgml
> *** doc/src/sgml/pltcl.sgml 22 Jan 2005 22:56:36 -0000 2.34
> --- doc/src/sgml/pltcl.sgml 11 Mar 2005 05:48:06 -0000
> ***************
> *** 401,407 ****
>          <para>
>           Returns the OID of the row inserted by the last
>           <function>spi_exec</> or <function>spi_execp</>,
> !         if the command was a single-row <command>INSERT</>.  (If not,
you get zero.)
>          </para>
>         </listitem>
>        </varlistentry>
> --- 401,408 ----
>          <para>
>           Returns the OID of the row inserted by the last
>           <function>spi_exec</> or <function>spi_execp</>,
> !         if the command was a single-row <command>INSERT</> and
> !         modified table contained OIDs.  (If not, you get zero.)
>          </para>
>         </listitem>
>        </varlistentry>
> Index: doc/src/sgml/runtime.sgml
> ===================================================================
> RCS file: /var/lib/cvs/pgsql/doc/src/sgml/runtime.sgml,v
> retrieving revision 1.307
> diff -c -r1.307 runtime.sgml
> *** doc/src/sgml/runtime.sgml 4 Mar 2005 20:21:05 -0000 1.307
> --- doc/src/sgml/runtime.sgml 11 Mar 2005 05:20:38 -0000
> ***************
> *** 3587,3609 ****
>           newly-created tables, if neither <literal>WITH OIDS</literal>
>           nor <literal>WITHOUT OIDS</literal> is specified. It also
>           determines whether OIDs will be included in tables created by
> !         <command>SELECT INTO</command>. In
> !         <productname>PostgreSQL</productname> &version;
> !         <varname>default_with_oids</varname> defaults to true. This is
> !         also the behavior of previous versions of
> !         <productname>PostgreSQL</productname>. However, assuming that
> !         tables will contain OIDs by default is not encouraged. This
> !         option will probably default to false in a future release of
> !         <productname>PostgreSQL</productname>.
>          </para>
>
>          <para>
> !         To ease compatibility with applications that make use of OIDs,
> !         this option should left enabled. To ease compatibility with
> !         future versions of <productname>PostgreSQL</productname>, this
> !         option should be disabled, and applications that require OIDs
> !         on certain tables should explicitly specify <literal>WITH
> !         OIDS</literal> when those tables are created.
>          </para>
>         </listitem>
>        </varlistentry>
> --- 3587,3604 ----
>           newly-created tables, if neither <literal>WITH OIDS</literal>
>           nor <literal>WITHOUT OIDS</literal> is specified. It also
>           determines whether OIDs will be included in tables created by
> !         <command>SELECT INTO</command>. In <productname>PostgreSQL</>
> !         8.1 <varname>default_with_oids</> is disabled by default; in
> !         prior versions of PostgreSQL, it was true by default.
>          </para>
>
>          <para>
> !         The use of OIDs in user tables is considered deprecated, so
> !         most installations should leave this variable disabled.
> !         Applications that require OIDs for a particular table should
> !         specify <literal>WITH OIDS</literal> when creating the
> !         table. This variable can be enabled for compatibility with old
> !         applications that do not follow this behavior.
>          </para>
>         </listitem>
>        </varlistentry>
> Index: doc/src/sgml/ref/select_into.sgml
> ===================================================================
> RCS file: /var/lib/cvs/pgsql/doc/src/sgml/ref/select_into.sgml,v
> retrieving revision 1.33
> diff -c -r1.33 select_into.sgml
> *** doc/src/sgml/ref/select_into.sgml 9 Jan 2005 05:57:45 -0000 1.33
> --- doc/src/sgml/ref/select_into.sgml 11 Mar 2005 05:52:25 -0000
> ***************
> *** 94,107 ****
>     </para>
>
>     <para>
> !    Prior to <productname>PostgreSQL</> 8.0, the table created by
> !    <command>SELECT INTO</command> always included OIDs.
> !    As of <productname>PostgreSQL</> 8.0, the
> !    inclusion of OIDs in the table created by <command>SELECT
> !    INTO</command> is controlled by the
> !    <xref linkend="guc-default-with-oids"> configuration variable. This
> !    variable currently defaults to true, but will likely default to
> !    false in a future release of <productname>PostgreSQL</>.
>     </para>
>    </refsect1>
>
> --- 94,106 ----
>     </para>
>
>     <para>
> !    Prior to <productname>PostgreSQL</> 8.1, the table created by
> !    <command>SELECT INTO</command> included OIDs by default. In
> !    <productname>PostgreSQL</productname> 8.1, this is not the case
> !    &mdash; to include OIDs in the created table, the <xref
> !    linkend="guc-default-with-oids"> configuration variable must be
> !    enabled. Alternatively, <command>CREATE TABLE AS</command> can be
> !    used with the <literal>WITH OIDS</literal> clause.
>     </para>
>    </refsect1>
>
> Index: src/backend/utils/misc/guc.c
> ===================================================================
> RCS file: /var/lib/cvs/pgsql/src/backend/utils/misc/guc.c,v
> retrieving revision 1.254
> diff -c -r1.254 guc.c
> *** src/backend/utils/misc/guc.c 4 Mar 2005 20:21:06 -0000 1.254
> --- src/backend/utils/misc/guc.c 11 Mar 2005 04:36:43 -0000
> ***************
> *** 139,145 ****
>
>   bool Password_encryption = true;
>
> ! bool default_with_oids = true;
>
>   int log_min_error_statement = PANIC;
>   int log_min_messages = NOTICE;
> --- 139,145 ----
>
>   bool Password_encryption = true;
>
> ! bool default_with_oids = false;
>
>   int log_min_error_statement = PANIC;
>   int log_min_messages = NOTICE;
> ***************
> *** 801,811 ****
>   },
>   {
>   {"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
> ! gettext_noop("By default, newly-created tables should have OIDs."),
>   NULL
>   },
>   &default_with_oids,
> ! true, NULL, NULL
>   },
>   {
>   {"redirect_stderr", PGC_POSTMASTER, LOGGING_WHERE,
> --- 801,811 ----
>   },
>   {
>   {"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
> ! gettext_noop("Create new tables with OIDs by default."),
>   NULL
>   },
>   &default_with_oids,
> ! false, NULL, NULL
>   },
>   {
>   {"redirect_stderr", PGC_POSTMASTER, LOGGING_WHERE,
> Index: src/backend/utils/misc/postgresql.conf.sample
> ===================================================================
> RCS file:
/var/lib/cvs/pgsql/src/backend/utils/misc/postgresql.conf.sample,v
> retrieving revision 1.135
> diff -c -r1.135 postgresql.conf.sample
> *** src/backend/utils/misc/postgresql.conf.sample 4 Mar 2005
20:21:06 -0000 1.135
> --- src/backend/utils/misc/postgresql.conf.sample 11 Mar 2005
04:37:06 -0000
> ***************
> *** 314,320 ****
>   #add_missing_from = true
>   #regex_flavor = advanced # advanced, extended, or basic
>   #sql_inheritance = true
> ! #default_with_oids = true
>
>   # - Other Platforms & Clients -
>
> --- 314,320 ----
>   #add_missing_from = true
>   #regex_flavor = advanced # advanced, extended, or basic
>   #sql_inheritance = true
> ! #default_with_oids = false
>
>   # - Other Platforms & Clients -
>
>


----------------------------------------------------------------------------
----


>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq
>



In response to

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2005-03-12 06:28:59
Subject: Re: pgsql: Handle carriage returns and line feeds in COPY
Previous:From: Neil ConwayDate: 2005-03-12 06:12:09
Subject: Re: pgsql: Handle carriage returns and line feeds in

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group