On Fri, 2003-10-10 at 05:56, Manfred Koizar wrote:
> On Tue, 30 Sep 2003 20:00:22 -0400, Neil Conway <[EMAIL PROTECTED]>
> wrote:
> >This patch adds a new GUC var, "default_use_oids"
> 
> Shouldn't it be honoured by CREATE TABLE AS SELECT ... ?

Good catch. I've attached an updated patch. I also included a few
improvements to the docs.

I think it would be a good idea to extend CREATE TABLE AS to allow WITH
OIDS and WITHOUT OIDS to be specified, so that it provides a better
option for people who need OIDs in their CREATE TABLE AS-generated
tables than manually setting the default_use_oids GUC var (CREATE TABLE
AS should also accept ON COMMIT ..., for that matter). But implementing
this will require changing the internal representation of CREATE TABLE
AS to be something more than just a wrapper over SelectStmt, I believe.
I haven't made this change in the attached patch, but I'll probably do
it before 7.5 is released. Any comments?

-Neil

Index: doc/src/sgml/datatype.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/datatype.sgml,v
retrieving revision 1.126
diff -c -r1.126 datatype.sgml
*** doc/src/sgml/datatype.sgml	16 Oct 2003 04:52:21 -0000	1.126
--- doc/src/sgml/datatype.sgml	17 Oct 2003 19:03:44 -0000
***************
*** 2891,2913 ****
  
     <para>
      Object identifiers (OIDs) are used internally by
!     <productname>PostgreSQL</productname> as primary keys for various system
!     tables.  Also, an OID system column is added to user-created tables
!     (unless <literal>WITHOUT OIDS</> is specified at table creation time).
!     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 <type>regtype</>. <xref linkend="datatype-oid-table"> shows an overview.
     </para>
  
     <para>
!     The <type>oid</> type is currently implemented as an unsigned four-byte
!     integer.
!     Therefore, it is not large enough to provide database-wide uniqueness
!     in large databases, or even in large individual tables.  So, using a
!     user-created table's OID column as a primary key is discouraged.
!     OIDs are best used only for references to system tables.
!    </para>
  
     <para>
      The <type>oid</> type itself has few operations beyond comparison.
--- 2891,2932 ----
  
     <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 <varname>default_use_oids</varname>
!     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
!     <type>regtype</>. <xref linkend="datatype-oid-table"> shows an
!     overview.
     </para>
  
     <para>
!     The <type>oid</> type is currently implemented as an unsigned
!     four-byte integer.  Therefore, it is not large enough to provide
!     database-wide uniqueness in large databases, or even in large
!     individual tables.  So, using a user-created table's OID column as
!     a primary key is discouraged.  OIDs are best used only for
!     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_use_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.
Index: doc/src/sgml/runtime.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/runtime.sgml,v
retrieving revision 1.213
diff -c -r1.213 runtime.sgml
*** doc/src/sgml/runtime.sgml	10 Oct 2003 02:08:42 -0000	1.213
--- doc/src/sgml/runtime.sgml	17 Oct 2003 20:02:18 -0000
***************
*** 2494,2500 ****
        </listitem>
       </varlistentry>
  
!           </variablelist>
      </sect3>
      <sect3 id="runtime-config-compatible-clients">
       <title>Platform and Client Compatibility</title>
--- 2494,2531 ----
        </listitem>
       </varlistentry>
  
!      <varlistentry>
!       <term><varname>default_use_oids</varname> (<type>boolean</type>)</term>
!       <listitem>
!        <para>
!         This controls whether <command>CREATE TABLE</command> will
!         include OIDs in newly-created tables, if neither <literal>WITH
!         OIDS</literal> or <literal>WITHOUT OIDS</literal> have been
!         specified. It also determines whether OIDs will be included in
!         the table generated by <command>SELECT INTO</command> and
!         <command>CREATE TABLE AS</command>. In
!         <productname>PostgreSQL</productname> &version;
!         <varname>default_use_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. Therefore, this option will 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 explictely specify <literal>WITH
!         OIDS</literal> when issuing the <command>CREATE
!         TABLE</command> statements for the tables in question.
!        </para>
!       </listitem>
!      </varlistentry>
! 
!      </variablelist>
      </sect3>
      <sect3 id="runtime-config-compatible-clients">
       <title>Platform and Client Compatibility</title>
Index: doc/src/sgml/spi.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/spi.sgml,v
retrieving revision 1.27
diff -c -r1.27 spi.sgml
*** doc/src/sgml/spi.sgml	31 Aug 2003 17:32:20 -0000	1.27
--- doc/src/sgml/spi.sgml	17 Oct 2003 20:08:42 -0000
***************
*** 319,325 ****
       <listitem>
        <para>
         if a <command>SELECT</command> (but not <command>SELECT
!        ... INTO</>) was executed
        </para>
       </listitem>
      </varlistentry>
--- 319,325 ----
       <listitem>
        <para>
         if a <command>SELECT</command> (but not <command>SELECT
!        INTO</>) was executed
        </para>
       </listitem>
      </varlistentry>
***************
*** 328,334 ****
       <term><symbol>SPI_OK_SELINTO</symbol></term>
       <listitem>
        <para>
!        if a <command>SELECT ... INTO</command> was executed
        </para>
       </listitem>
      </varlistentry>
--- 328,334 ----
       <term><symbol>SPI_OK_SELINTO</symbol></term>
       <listitem>
        <para>
!        if a <command>SELECT INTO</command> was executed
        </para>
       </listitem>
      </varlistentry>
Index: doc/src/sgml/ref/alter_table.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/alter_table.sgml,v
retrieving revision 1.62
diff -c -r1.62 alter_table.sgml
*** doc/src/sgml/ref/alter_table.sgml	22 Sep 2003 00:16:57 -0000	1.62
--- doc/src/sgml/ref/alter_table.sgml	17 Oct 2003 19:03:44 -0000
***************
*** 149,154 ****
--- 149,160 ----
        of the OID are kept indefinitely.  This is semantically similar
        to the <literal>DROP COLUMN</literal> process.
       </para>
+ 
+      <para>
+       Note that there is no variant of <command>ALTER TABLE</command>
+       that allows OIDs to be restored to a table once they have been
+       removed.
+      </para>
      </listitem>
     </varlistentry>
  
Index: doc/src/sgml/ref/create_table.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/create_table.sgml,v
retrieving revision 1.72
diff -c -r1.72 create_table.sgml
*** doc/src/sgml/ref/create_table.sgml	9 Sep 2003 18:28:52 -0000	1.72
--- doc/src/sgml/ref/create_table.sgml	17 Oct 2003 19:10:56 -0000
***************
*** 111,122 ****
       <para>
        If specified, the table is created as a temporary table.
        Temporary tables are automatically dropped at the end of a
!       session, or optionally at the end of the current transaction 
!       (see ON COMMIT below).  Existing permanent tables with the same 
!       name are not visible to the current session while the temporary 
!       table exists, unless they are referenced with schema-qualified 
!       names. Any indexes created on a temporary table are automatically
!       temporary as well.
       </para>
  
       <para>
--- 111,122 ----
       <para>
        If specified, the table is created as a temporary table.
        Temporary tables are automatically dropped at the end of a
!       session, or optionally at the end of the current transaction
!       (see <literal>ON COMMIT</literal> below).  Existing permanent
!       tables with the same name are not visible to the current session
!       while the temporary table exists, unless they are referenced
!       with schema-qualified names. Any indexes created on a temporary
!       table are automatically temporary as well.
       </para>
  
       <para>
***************
*** 243,264 ****
      <listitem>
       <para>
        This optional clause specifies whether rows of the new table
!       should have OIDs (object identifiers) assigned to them.  The
!       default is to have OIDs.  (If the new table inherits from any
!       tables that have OIDs, then <literal>WITH OIDS</> is forced even
!       if the command says <literal>WITHOUT OIDS</>.)
       </para>
  
       <para>
!       Specifying <literal>WITHOUT OIDS</> allows the user to suppress
!       generation of OIDs for rows of a table.  This may be worthwhile
!       for large tables, since it will reduce OID consumption and
!       thereby postpone wraparound of the 32-bit OID counter.  Once the
!       counter wraps around, uniqueness of OIDs can no longer be
!       assumed, which considerably reduces their usefulness. Specifying
!       <literal>WITHOUT OIDS</literal> also reduces the space required
!       to store the table on disk by 4 bytes per row of the table,
!       thereby improving performance.
       </para>
      </listitem>
     </varlistentry>
--- 243,272 ----
      <listitem>
       <para>
        This optional clause specifies whether rows of the new table
!       should have OIDs (object identifiers) assigned to them.  If
!       neither <literal>WITH OIDS</literal> nor <literal>WITHOUT
!       OIDS</literal> is specified, the default value depends upon the
!       <varname>default_use_oids</varname> configuration parameter. (If
!       the new table inherits from any tables that have OIDs, then
!       <literal>WITH OIDS</> is forced even if the command says
!       <literal>WITHOUT OIDS</>.)
       </para>
  
       <para>
!       If <literal>WITHOUT OIDS</literal> is specified or implied, this
!       means that the generation of OIDs for this table will be
!       supressed. This is generally considered worthwhile, since it
!       will reduce OID consumption and thereby postpone the wraparound
!       of the 32-bit OID counter. Once the counter wraps around, OIDs
!       can no longer be assumed to be unique, which makes them
!       considerably less useful. In addition, excluding OIDs from a
!       table reduces the space required on disk to storage the table by
!       4 bytes per row, leading to increased performance.
!      </para>
! 
!      <para>
!       To remove OIDs from a table after it has been created, use <xref
!       linkend="sql-altertable" endterm="sql-altertable-title">.
       </para>
      </listitem>
     </varlistentry>
***************
*** 570,587 ****
    <itemizedlist>
     <listitem>
      <para>
!      Whenever an application makes use of OIDs to identify specific
       rows of a table, it is recommended to create a unique constraint
       on the <structfield>oid</> column of that table, to ensure that
       OIDs in the table will indeed uniquely identify rows even after
       counter wraparound.  Avoid assuming that OIDs are unique across
       tables; if you need a database-wide unique identifier, use the
       combination of <structfield>tableoid</> and row OID for the
!      purpose.  (It is likely that future <productname>PostgreSQL</>
!      releases will use a separate OID counter for each table, so that
!      it will be <emphasis>necessary</>, not optional, to include
!      <structfield>tableoid</> to have a unique identifier
!      database-wide.)
      </para>
  
      <tip>
--- 578,594 ----
    <itemizedlist>
     <listitem>
      <para>
!      Using OIDs in new applications is not recommended: where
!      possible, using a <literal>SERIAL</literal> or other sequence
!      generator as the table's primary key is preferred. However, if
!      your application does make use of OIDs to identify specific rows
       rows of a table, it is recommended to create a unique constraint
       on the <structfield>oid</> column of that table, to ensure that
       OIDs in the table will indeed uniquely identify rows even after
       counter wraparound.  Avoid assuming that OIDs are unique across
       tables; if you need a database-wide unique identifier, use the
       combination of <structfield>tableoid</> and row OID for the
!      purpose.
      </para>
  
      <tip>
Index: doc/src/sgml/ref/create_table_as.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/create_table_as.sgml,v
retrieving revision 1.16
diff -c -r1.16 create_table_as.sgml
*** doc/src/sgml/ref/create_table_as.sgml	9 Sep 2003 18:28:53 -0000	1.16
--- doc/src/sgml/ref/create_table_as.sgml	17 Oct 2003 20:34:50 -0000
***************
*** 51,57 ****
  
   <refsect1>
    <title>Parameters</title>
!    
    <variablelist>
     <varlistentry>
      <term><literal>TEMPORARY</> or <literal>TEMP</></term>
--- 51,70 ----
  
   <refsect1>
    <title>Parameters</title>
! 
!   <variablelist>
!    <varlistentry>
!     <term><literal>GLOBAL</literal> or <literal>LOCAL</literal></term>
!     <listitem>
!      <para>
!       Ignored for compatibility. Refer to <xref
!       linkend="sql-createtable" endterm="sql-createtable-title"> for
!       details.
!      </para>
!     </listitem>
!    </varlistentry>
!   </variablelist>
! 
    <variablelist>
     <varlistentry>
      <term><literal>TEMPORARY</> or <literal>TEMP</></term>
***************
*** 105,114 ****
    <title>Notes</title>
  
    <para>
!    This command is functionally equivalent to <xref
!    linkend="sql-selectinto" endterm="sql-selectinto-title">, but it is preferred since it is less
!    likely to be confused with other uses of the <command>SELECT
!    ... INTO</command> syntax.
    </para>
   </refsect1>
  
--- 118,141 ----
    <title>Notes</title>
  
    <para>
!    This command is functionally similar to <xref
!    linkend="sql-selectinto" endterm="sql-selectinto-title">, but it is
!    preferred since it is less likely to be confused with other uses of
!    the <command>SELECT INTO</command> syntax.
!   </para>
! 
!   <para>
!    Prior to PostgreSQL 7.5, <command>CREATE TABLE AS</command> always
!    included OIDs in the table it produced. Furthermore, these OIDs
!    were newly generated: they were distinct from the OIDs of any of
!    the rows in the source tables of the <command>SELECT</command> or
!    <command>EXECUTE</command> statement. Therefore, if <command>CREATE
!    TABLE AS</command> was frequently executed, the OID counter would
!    be rapidly incremented. As of PostgreSQL 7.5, the inclusion of OIDs
!    in the table generated by <command>CREATE TABLE AS</command> is
!    controlled by the <varname>default_use_oids</varname> configuration
!    variable. This variable currently defaults to true, but will likely
!    default to false in a future release of <productname>PostgreSQL</>.
    </para>
   </refsect1>
  
***************
*** 129,135 ****
  
    <simplelist type="inline">
     <member><xref linkend="sql-createtable" endterm="sql-createtable-title"></member>
-    <member><xref linkend="sql-createview" endterm="sql-createview-title"></member>
     <member><xref linkend="sql-execute" endterm="sql-execute-title"></member>
     <member><xref linkend="sql-select" endterm="sql-select-title"></member>
     <member><xref linkend="sql-selectinto" endterm="sql-selectinto-title"></member>
--- 156,161 ----
Index: doc/src/sgml/ref/pg_dump.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/pg_dump.sgml,v
retrieving revision 1.65
diff -c -r1.65 pg_dump.sgml
*** doc/src/sgml/ref/pg_dump.sgml	23 Sep 2003 22:48:53 -0000	1.65
--- doc/src/sgml/ref/pg_dump.sgml	17 Oct 2003 19:03:44 -0000
***************
*** 611,618 ****
    </para>
  
    <para>
!    Once restored, it is wise to run <command>ANALYZE</> on each
!    restored table so the optimizer has useful statistics.
    </para>
  
   </refsect1>
--- 611,621 ----
    </para>
  
    <para>
!    The dump file produced by <application>pg_dump</application> does
!    not contain the statistics used by the optimizer to make query
!    planning decisions.  Therefore, it is wise to run
!    <command>ANALYZE</command> after restoring from a dump file to
!    ensure good performance.
    </para>
  
   </refsect1>
Index: doc/src/sgml/ref/prepare.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/prepare.sgml,v
retrieving revision 1.7
diff -c -r1.7 prepare.sgml
*** doc/src/sgml/ref/prepare.sgml	9 Sep 2003 18:28:53 -0000	1.7
--- doc/src/sgml/ref/prepare.sgml	17 Oct 2003 20:15:49 -0000
***************
*** 52,64 ****
    </para>
  
    <para>
!    Prepared statements are only stored in and for the duration of
!    the current database session. When
!    the session ends, the prepared statement is forgotten, and so it must be
!    recreated before being used again. This also means that a single
!    prepared statement cannot be used by multiple simultaneous database
!    clients; however, each client can create their own prepared statement
!    to use.
    </para>
  
    <para>
--- 52,63 ----
    </para>
  
    <para>
!    Prepared statements are only for the duration of the current
!    database session. When the session ends, the prepared statement is
!    forgotten, so it must be recreated before being used again. This
!    also means that a single prepared statement cannot be used by
!    multiple simultaneous database clients; however, each client can
!    create their own prepared statement to use.
    </para>
  
    <para>
Index: doc/src/sgml/ref/select_into.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/select_into.sgml,v
retrieving revision 1.24
diff -c -r1.24 select_into.sgml
*** doc/src/sgml/ref/select_into.sgml	9 Sep 2003 18:28:53 -0000	1.24
--- doc/src/sgml/ref/select_into.sgml	17 Oct 2003 20:21:11 -0000
***************
*** 82,94 ****
    <title>Notes</title>
  
    <para>
!    <xref linkend="sql-createtableas" endterm="sql-createtableas-title">
!    is functionally equivalent to <command>SELECT INTO</command>.
!    <command>CREATE TABLE AS</command> is the recommended syntax, since
!    this form of <command>SELECT INTO</command> is not available in
!    <application>ECPG</application> or
!    <application>PL/pgSQL</application>, because they interpret the
!    <literal>INTO</literal> clause differently.
    </para>
   </refsect1>
  
--- 82,110 ----
    <title>Notes</title>
  
    <para>
!    <xref linkend="sql-createtableas"
!    endterm="sql-createtableas-title"> is functionally similar to
!    <command>SELECT INTO</command>.  <command>CREATE TABLE AS</command>
!    is the recommended syntax, since this form of <command>SELECT
!    INTO</command> is not available in <application>ECPG</application>
!    or <application>PL/pgSQL</application>, because they interpret the
!    <literal>INTO</literal> clause differently. Furthermore,
!    <command>CREATE TABLE AS</command> offers a superset of the
!    functionality provided by <command>SELECT INTO</command>.
!   </para>
! 
!   <para>
!    Prior to PostgreSQL 7.5, the table created by <command>SELECT
!    INTO</command> always included OIDs. Furthermore, these OIDs were
!    newly generated: they were distinct from the OIDs of any of the
!    rows in the source tables of the <command>SELECT INTO</command>
!    statement. Therefore, if <command>SELECT INTO</command> was
!    frequently executed, the OID counter would be rapidly
!    incremented. As of PostgreSQL 7.5, the inclusion of OIDs in the
!    table created by <command>SELECT INTO</command> is controlled by
!    the <varname>default_use_oids</varname> configuration
!    variable. This variable currently defaults to true, but will likely
!    default to false in a future release of <productname>PostgreSQL</>.
    </para>
   </refsect1>
  
***************
*** 96,102 ****
    <title>Compatibility</title>
  
    <para>
!    The SQL standard uses <command>SELECT ... INTO</command> to
     represent selecting values into scalar variables of a host program,
     rather than creating a new table.  This indeed is the usage found
     in <application>ECPG</application> (see <xref linkend="ecpg">) and
--- 112,118 ----
    <title>Compatibility</title>
  
    <para>
!    The SQL standard uses <command>SELECT INTO</command> to
     represent selecting values into scalar variables of a host program,
     rather than creating a new table.  This indeed is the usage found
     in <application>ECPG</application> (see <xref linkend="ecpg">) and
Index: src/backend/executor/execMain.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/executor/execMain.c,v
retrieving revision 1.220
diff -c -r1.220 execMain.c
*** src/backend/executor/execMain.c	1 Oct 2003 21:30:52 -0000	1.220
--- src/backend/executor/execMain.c	17 Oct 2003 19:45:13 -0000
***************
*** 43,48 ****
--- 43,49 ----
  #include "optimizer/var.h"
  #include "parser/parsetree.h"
  #include "utils/acl.h"
+ #include "utils/guc.h"
  #include "utils/lsyscache.h"
  
  
***************
*** 593,603 ****
  		do_select_into = true;
  
  		/*
! 		 * For now, always create OIDs in SELECT INTO; this is for
! 		 * backwards compatibility with pre-7.3 behavior.  Eventually we
! 		 * might want to allow the user to choose.
  		 */
! 		estate->es_force_oids = true;
  	}
  
  	/*
--- 594,605 ----
  		do_select_into = true;
  
  		/*
! 		 * The presence of OIDs in the result set of SELECT INTO is
! 		 * controlled by the default_use_oids GUC parameter. The
! 		 * behavior in versions of PostgreSQL prior to 7.5 is to
! 		 * always include OIDs.
  		 */
! 		estate->es_force_oids = default_use_oids;
  	}
  
  	/*
Index: src/backend/parser/gram.y
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/parser/gram.y,v
retrieving revision 2.436
diff -c -r2.436 gram.y
*** src/backend/parser/gram.y	2 Oct 2003 06:34:04 -0000	2.436
--- src/backend/parser/gram.y	17 Oct 2003 19:03:44 -0000
***************
*** 63,68 ****
--- 63,69 ----
  #include "utils/numeric.h"
  #include "utils/datetime.h"
  #include "utils/date.h"
+ #include "utils/guc.h"
  
  extern List *parsetree;			/* final parse result is delivered here */
  
***************
*** 1820,1826 ****
  OptWithOids:
  			WITH OIDS								{ $$ = TRUE; }
  			| WITHOUT OIDS							{ $$ = FALSE; }
! 			| /*EMPTY*/								{ $$ = TRUE; }
  		;
  
  OnCommitOption:  ON COMMIT DROP				{ $$ = ONCOMMIT_DROP; }
--- 1821,1832 ----
  OptWithOids:
  			WITH OIDS								{ $$ = TRUE; }
  			| WITHOUT OIDS							{ $$ = FALSE; }
! 			/*
! 			 * If the user didn't explicitely specify WITH or WITHOUT
! 			 * OIDS, decide whether to include OIDs based on the
! 			 * "default_use_oids" GUC var
! 			 */
! 			| /*EMPTY*/								{ $$ = default_use_oids; }
  		;
  
  OnCommitOption:  ON COMMIT DROP				{ $$ = ONCOMMIT_DROP; }
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/misc/guc.c,v
retrieving revision 1.163
diff -c -r1.163 guc.c
*** src/backend/utils/misc/guc.c	8 Oct 2003 03:49:38 -0000	1.163
--- src/backend/utils/misc/guc.c	17 Oct 2003 19:03:44 -0000
***************
*** 124,129 ****
--- 124,131 ----
  
  bool		Password_encryption = true;
  
+ bool		default_use_oids = true;
+ 
  int			log_min_error_statement = PANIC;
  int			log_min_messages = NOTICE;
  int			client_min_messages = NOTICE;
***************
*** 261,267 ****
  	/* QUERY_TUNING */
  	gettext_noop("Query Tuning"),
  	/* QUERY_TUNING_METHOD */
! 	gettext_noop("Query Tuning / Planner Method Enabling"),
  	/* QUERY_TUNING_COST */
  	gettext_noop("Query Tuning / Planner Cost Constants"),
  	/* QUERY_TUNING_GEQO */
--- 263,269 ----
  	/* QUERY_TUNING */
  	gettext_noop("Query Tuning"),
  	/* QUERY_TUNING_METHOD */
! 	gettext_noop("Query Tuning / Planner Method Configuration"),
  	/* QUERY_TUNING_COST */
  	gettext_noop("Query Tuning / Planner Cost Constants"),
  	/* QUERY_TUNING_GEQO */
***************
*** 830,835 ****
--- 832,845 ----
  		&check_function_bodies,
  		true, NULL, NULL
  	},
+ 	{
+ 		{"default_use_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
+ 		 gettext_noop("by default, newly-created tables should have OIDs"),
+ 		 NULL
+ 		},
+ 		&default_use_oids,
+ 		true, NULL, NULL
+ 	},
  
  	/* End-of-list marker */
  	{
Index: src/backend/utils/misc/postgresql.conf.sample
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/misc/postgresql.conf.sample,v
retrieving revision 1.92
diff -c -r1.92 postgresql.conf.sample
*** src/backend/utils/misc/postgresql.conf.sample	8 Oct 2003 03:49:38 -0000	1.92
--- src/backend/utils/misc/postgresql.conf.sample	17 Oct 2003 19:03:44 -0000
***************
*** 94,100 ****
  # QUERY TUNING
  #---------------------------------------------------------------------------
  
! # - Planner Method Enabling -
  
  #enable_hashagg = true
  #enable_hashjoin = true
--- 94,100 ----
  # QUERY TUNING
  #---------------------------------------------------------------------------
  
! # - Planner Method Configuration -
  
  #enable_hashagg = true
  #enable_hashjoin = true
***************
*** 249,254 ****
--- 249,255 ----
  #add_missing_from = true
  #regex_flavor = advanced	# advanced, extended, or basic
  #sql_inheritance = true
+ #default_use_oids = true
  
  # - Other Platforms & Clients -
  
Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.353
diff -c -r1.353 pg_dump.c
*** src/bin/pg_dump/pg_dump.c	8 Oct 2003 03:52:32 -0000	1.353
--- src/bin/pg_dump/pg_dump.c	17 Oct 2003 19:03:44 -0000
***************
*** 5401,5408 ****
  			appendPQExpBuffer(q, ")");
  		}
  
! 		if (!tbinfo->hasoids)
! 			appendPQExpBuffer(q, " WITHOUT OIDS");
  
  		appendPQExpBuffer(q, ";\n");
  
--- 5401,5407 ----
  			appendPQExpBuffer(q, ")");
  		}
  
! 		appendPQExpBuffer(q, tbinfo->hasoids ? " WITH OIDS" : " WITHOUT OIDS");
  
  		appendPQExpBuffer(q, ";\n");
  
Index: src/bin/psql/tab-complete.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/bin/psql/tab-complete.c,v
retrieving revision 1.89
diff -c -r1.89 tab-complete.c
*** src/bin/psql/tab-complete.c	17 Oct 2003 11:52:06 -0000	1.89
--- src/bin/psql/tab-complete.c	17 Oct 2003 19:03:44 -0000
***************
*** 535,540 ****
--- 535,541 ----
  		"default_statistics_target",
  		"default_transaction_isolation",
  		"default_transaction_read_only",
+ 		"default_use_oids",
  		"dynamic_library_path",
  		"effective_cache_size",
  		"enable_hashagg",
Index: src/include/utils/guc.h
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/include/utils/guc.h,v
retrieving revision 1.41
diff -c -r1.41 guc.h
*** src/include/utils/guc.h	1 Sep 2003 04:15:51 -0000	1.41
--- src/include/utils/guc.h	17 Oct 2003 19:03:44 -0000
***************
*** 109,114 ****
--- 109,116 ----
  extern bool SQL_inheritance;
  extern bool Australian_timezones;
  
+ extern bool default_use_oids;
+ 
  extern int	log_min_error_statement;
  extern int	log_min_messages;
  extern int	client_min_messages;
Index: src/test/regress/expected/without_oid.out
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/test/regress/expected/without_oid.out,v
retrieving revision 1.1
diff -c -r1.1 without_oid.out
*** src/test/regress/expected/without_oid.out	20 Jul 2002 05:39:46 -0000	1.1
--- src/test/regress/expected/without_oid.out	17 Oct 2003 20:13:49 -0000
***************
*** 1,7 ****
  --
  -- WITHOUT OID
  --
! CREATE TABLE wi (i INT);
  CREATE TABLE wo (i INT) WITHOUT OIDS;
  INSERT INTO wi VALUES (1);  -- 1
  INSERT INTO wo SELECT i FROM wi;  -- 1
--- 1,7 ----
  --
  -- WITHOUT OID
  --
! CREATE TABLE wi (i INT) WITH OIDS;
  CREATE TABLE wo (i INT) WITHOUT OIDS;
  INSERT INTO wi VALUES (1);  -- 1
  INSERT INTO wo SELECT i FROM wi;  -- 1
Index: src/test/regress/sql/without_oid.sql
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/test/regress/sql/without_oid.sql,v
retrieving revision 1.1
diff -c -r1.1 without_oid.sql
*** src/test/regress/sql/without_oid.sql	20 Jul 2002 05:39:46 -0000	1.1
--- src/test/regress/sql/without_oid.sql	17 Oct 2003 20:03:58 -0000
***************
*** 2,8 ****
  -- WITHOUT OID
  --
  
! CREATE TABLE wi (i INT);
  CREATE TABLE wo (i INT) WITHOUT OIDS;
  INSERT INTO wi VALUES (1);  -- 1
  INSERT INTO wo SELECT i FROM wi;  -- 1
--- 2,8 ----
  -- WITHOUT OID
  --
  
! CREATE TABLE wi (i INT) WITH OIDS;
  CREATE TABLE wo (i INT) WITHOUT OIDS;
  INSERT INTO wi VALUES (1);  -- 1
  INSERT INTO wo SELECT i FROM wi;  -- 1
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to