default to WITHOUT OIDS

Поиск
Список
Период
Сортировка
Искать

default to WITHOUT OIDS

От:
Neil Conway <neilc@samurai.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 ****
     
      Object identifiers (OIDs) are used internally by
      PostgreSQL as primary keys for various
!     system tables.  An OID system column is also added to user-created
!     tables, unless WITHOUT OIDS is specified when
!     the table is created, or the 
!     configuration variable is set to false.  Type oid</>
      represents an object identifier.  There are also several alias
      types for oid</>: regproc</>, regprocedure</>,
      regoper</>, regoperator</>, regclass</>, and
--- 2980,2989 ----
     
      Object identifiers (OIDs) are used internally by
      PostgreSQL as primary keys for various
!     system tables.  OIDs are not added to user-created tables, unless
!     WITH OIDS is specified when the table is
!     created, or the 
!     configuration variable is set to true.  Type oid</>
      represents an object identifier.  There are also several alias
      types for oid</>: regproc</>, regprocedure</>,
      regoper</>, regoperator</>, regclass</>, and
***************
*** 3000,3027 ****
      references to system tables.
     
  
-    
-     
-      OIDs are included by default in user-created tables in
-      PostgreSQL &version;. However, this
-      behavior is likely to change in a future version of
-      PostgreSQL. Eventually, user-created
-      tables will not include an OID system column unless WITH
-      OIDS is specified when the table is created, or the
-      default_with_oids configuration variable is set
-      to true. If your application requires the presence of an OID
-      system column in a table, it should specify WITH
-      OIDS when that table is created to ensure compatibility
-      with future releases of PostgreSQL.
-     
-    
- 
     
      The 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.)
     
  
     
--- 3000,3010 ----
      references to system tables.
     
  
     
      The 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.)
     
  
     
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 ****
         OID
         column
        
!       The object identifier (object ID) of a row.  This is a serial
!       number that is automatically added by
!       PostgreSQL to all table rows (unless
!       the table was created using WITHOUT OIDS, in which
!       case this column is not present).  This column is of type
        oid (same name as the column); see  for more information about the type.
       
--- 868,877 ----
         OID
         column
        
!       The object identifier (object ID) of a row. This column is only
!       present if the table was created using WITH
!       OIDS, or if the 
!       configuration variable was enabled. This column is of type
        oid (same name as the column); see  for more information about the type.
       
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 SQL engine, and RESULT_OID</>,
       the OID of the last row inserted by the most recent
       SQL command.  Note that RESULT_OID</>
!      is only useful after an INSERT command.
      
  
      
--- 1299,1306 ----
       the SQL engine, and RESULT_OID</>,
       the OID of the last row inserted by the most recent
       SQL command.  Note that RESULT_OID</>
!      is only useful after an INSERT command into a
!      table containing OIDs.
      
  
      
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 ****
         
          Returns the OID of the row inserted by the last
          spi_exec</> or spi_execp</>,
!         if the command was a single-row INSERT</>.  (If not, you get zero.)
         
        
       
--- 401,408 ----
         
          Returns the OID of the row inserted by the last
          spi_exec</> or spi_execp</>,
!         if the command was a single-row INSERT</> and
!         modified table contained OIDs.  (If not, you get zero.)
         
        
       
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 WITH OIDS
          nor WITHOUT OIDS is specified. It also
          determines whether OIDs will be included in tables created by
!         SELECT INTO. In
!         PostgreSQL &version;
!         default_with_oids defaults to true. This is
!         also the behavior of previous versions of
!         PostgreSQL. However, assuming that
!         tables will contain OIDs by default is not encouraged. This
!         option will probably default to false in a future release of
!         PostgreSQL.
         
  
         
!         To ease compatibility with applications that make use of OIDs,
!         this option should left enabled. To ease compatibility with
!         future versions of PostgreSQL, this
!         option should be disabled, and applications that require OIDs
!         on certain tables should explicitly specify WITH
!         OIDS when those tables are created.
         
        
       
--- 3587,3604 ----
          newly-created tables, if neither WITH OIDS
          nor WITHOUT OIDS is specified. It also
          determines whether OIDs will be included in tables created by
!         SELECT INTO. In PostgreSQL</>
!         8.1 default_with_oids</> is disabled by default; in
!         prior versions of PostgreSQL, it was true by default.
         
  
         
!         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 WITH OIDS when creating the
!         table. This variable can be enabled for compatibility with old
!         applications that do not follow this behavior.
         
        
       
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 ****
    
  
    
!    Prior to PostgreSQL</> 8.0, the table created by
!    SELECT INTO always included OIDs.
!    As of PostgreSQL</> 8.0, the
!    inclusion of OIDs in the table created by SELECT
!    INTO is controlled by the
!     configuration variable. This
!    variable currently defaults to true, but will likely default to
!    false in a future release of PostgreSQL</>.
    
   
  
--- 94,106 ----
    
  
    
!    Prior to PostgreSQL</> 8.1, the table created by
!    SELECT INTO included OIDs by default. In
!    PostgreSQL 8.1, this is not the case
!    — to include OIDs in the created table, the  configuration variable must be
!    enabled. Alternatively, CREATE TABLE AS can be
!    used with the WITH OIDS clause.
    
   
  
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 -
  

Re: default to WITHOUT OIDS

От:
"Qingqing Zhou" <zhouqq@cs.toronto.edu>
Дата:
!    gettext_noop("Create new tables with OIDs by default."),
without?



"Neil Conway" 
> 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 ****
>      
>       Object identifiers (OIDs) are used internally by
>       PostgreSQL as primary keys for various
> !     system tables.  An OID system column is also added to user-created
> !     tables, unless WITHOUT OIDS is specified when
> !     the table is created, or the 
> !     configuration variable is set to false.  Type oid</>
>       represents an object identifier.  There are also several alias
>       types for oid</>: regproc</>, regprocedure</>,
>       regoper</>, regoperator</>, regclass</>, and
> --- 2980,2989 ----
>      
>       Object identifiers (OIDs) are used internally by
>       PostgreSQL as primary keys for various
> !     system tables.  OIDs are not added to user-created tables, unless
> !     WITH OIDS is specified when the table is
> !     created, or the 
> !     configuration variable is set to true.  Type oid</>
>       represents an object identifier.  There are also several alias
>       types for oid</>: regproc</>, regprocedure</>,
>       regoper</>, regoperator</>, regclass</>, and
> ***************
> *** 3000,3027 ****
>       references to system tables.
>      
>
> -    
> -     
> -      OIDs are included by default in user-created tables in
> -      PostgreSQL &version;. However, this
> -      behavior is likely to change in a future version of
> -      PostgreSQL. Eventually, user-created
> -      tables will not include an OID system column unless WITH
> -      OIDS is specified when the table is created, or the
> -      default_with_oids configuration variable is set
> -      to true. If your application requires the presence of an OID
> -      system column in a table, it should specify WITH
> -      OIDS when that table is created to ensure compatibility
> -      with future releases of PostgreSQL.
> -     
> -    
> -
>      
>       The 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.)
>      
>
>      
> --- 3000,3010 ----
>       references to system tables.
>      
>
>      
>       The 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.)
>      
>
>      
> 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 ****
>          OID
>          column
>         
> !       The object identifier (object ID) of a row.  This is a serial
> !       number that is automatically added by
> !       PostgreSQL to all table rows (unless
> !       the table was created using WITHOUT OIDS, in
which
> !       case this column is not present).  This column is of type
>         oid (same name as the column); see          linkend="datatype-oid"> for more information about the type.
>        
> --- 868,877 ----
>          OID
>          column
>         
> !       The object identifier (object ID) of a row. This column is only
> !       present if the table was created using WITH
> !       OIDS, or if the 
> !       configuration variable was enabled. This column is of type
>         oid (same name as the column); see          linkend="datatype-oid"> for more information about the type.
>        
> 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 SQL engine, and RESULT_OID</>,
>        the OID of the last row inserted by the most recent
>        SQL command.  Note that RESULT_OID</>
> !      is only useful after an INSERT command.
>       
>
>       
> --- 1299,1306 ----
>        the SQL engine, and RESULT_OID</>,
>        the OID of the last row inserted by the most recent
>        SQL command.  Note that RESULT_OID</>
> !      is only useful after an INSERT command into a
> !      table containing OIDs.
>       
>
>       
> 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 ****
>          
>           Returns the OID of the row inserted by the last
>           spi_exec</> or spi_execp</>,
> !         if the command was a single-row INSERT</>.  (If not,
you get zero.)
>          
>         
>        
> --- 401,408 ----
>          
>           Returns the OID of the row inserted by the last
>           spi_exec</> or spi_execp</>,
> !         if the command was a single-row INSERT</> and
> !         modified table contained OIDs.  (If not, you get zero.)
>          
>         
>        
> 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 WITH OIDS
>           nor WITHOUT OIDS is specified. It also
>           determines whether OIDs will be included in tables created by
> !         SELECT INTO. In
> !         PostgreSQL &version;
> !         default_with_oids defaults to true. This is
> !         also the behavior of previous versions of
> !         PostgreSQL. However, assuming that
> !         tables will contain OIDs by default is not encouraged. This
> !         option will probably default to false in a future release of
> !         PostgreSQL.
>          
>
>          
> !         To ease compatibility with applications that make use of OIDs,
> !         this option should left enabled. To ease compatibility with
> !         future versions of PostgreSQL, this
> !         option should be disabled, and applications that require OIDs
> !         on certain tables should explicitly specify WITH
> !         OIDS when those tables are created.
>          
>         
>        
> --- 3587,3604 ----
>           newly-created tables, if neither WITH OIDS
>           nor WITHOUT OIDS is specified. It also
>           determines whether OIDs will be included in tables created by
> !         SELECT INTO. In PostgreSQL</>
> !         8.1 default_with_oids</> is disabled by default; in
> !         prior versions of PostgreSQL, it was true by default.
>          
>
>          
> !         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 WITH OIDS when creating the
> !         table. This variable can be enabled for compatibility with old
> !         applications that do not follow this behavior.
>          
>         
>        
> 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 ****
>     
>
>     
> !    Prior to PostgreSQL</> 8.0, the table created by
> !    SELECT INTO always included OIDs.
> !    As of PostgreSQL</> 8.0, the
> !    inclusion of OIDs in the table created by SELECT
> !    INTO is controlled by the
> !     configuration variable. This
> !    variable currently defaults to true, but will likely default to
> !    false in a future release of PostgreSQL</>.
>     
>    
>
> --- 94,106 ----
>     
>
>     
> !    Prior to PostgreSQL</> 8.1, the table created by
> !    SELECT INTO included OIDs by default. In
> !    PostgreSQL 8.1, this is not the case
> !    — to include OIDs in the created table, the  !    linkend="guc-default-with-oids"> configuration variable must be
> !    enabled. Alternatively, CREATE TABLE AS can be
> !    used with the WITH OIDS clause.
>     
>    
>
> 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
>


Re: default to WITHOUT OIDS

От:
Neil Conway <neilc@samurai.com>
Дата:
Qingqing Zhou wrote:
> !    gettext_noop("Create new tables with OIDs by default."),
> without?

Right: if the variable is "on", Postgres will "create new tables with 
OIDs by default". If the variable is "off", it won't. This is similar to 
how the check_function_bodies GUC var is already documented.

(Speaking of which, it would be good if the descriptions of the GUC 
variables were more consistent with one another. Some say that a 
variable "Sets the threshold of FROM items beyond which GEQO will be 
used", for example, whereas others merely state what the variable 
controls -- e.g. "Encrypt passwords".)

-Neil

Re: default to WITHOUT OIDS

От:
Neil Conway <neilc@samurai.com>
Дата:
Neil Conway wrote:
> This patch makes default_with_oids disabled by default, per earlier 
> discussion, and updates the documentation accordingly.

Applied.

-Neil
FAQ