Index: doc/src/sgml/datatype.sgml =================================================================== RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/datatype.sgml,v retrieving revision 1.124 diff -c -r1.124 datatype.sgml *** doc/src/sgml/datatype.sgml 12 Sep 2003 22:17:22 -0000 1.124 --- doc/src/sgml/datatype.sgml 30 Sep 2003 23:39:42 -0000 *************** *** 2888,2910 **** Object identifiers (OIDs) are used internally by ! PostgreSQL as primary keys for various system ! tables. Also, an OID system column is added to user-created tables ! (unless WITHOUT OIDS is specified at table creation time). ! Type oid represents an object identifier. There are also ! several alias types for oid: regproc, regprocedure, ! regoper, regoperator, regclass, ! and regtype. shows an overview. ! The 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. ! The oid type itself has few operations beyond comparison. --- 2888,2929 ---- 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 default_use_oids ! 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 ! regtype. shows an ! overview. ! The 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. ! ! ! ! ! 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_use_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. Index: doc/src/sgml/runtime.sgml =================================================================== RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/runtime.sgml,v retrieving revision 1.209 diff -c -r1.209 runtime.sgml *** doc/src/sgml/runtime.sgml 20 Sep 2003 20:12:05 -0000 1.209 --- doc/src/sgml/runtime.sgml 30 Sep 2003 21:24:05 -0000 *************** *** 2482,2488 **** ! Platform and Client Compatibility --- 2482,2515 ---- ! ! default_use_oids (boolean) ! ! ! This controls whether CREATE TABLE will ! include OIDs in newly-created tables, if neither WITH ! OIDS or WITHOUT OIDS have been ! specified. In PostgreSQL &version; ! this defaults to true. This is also the behavior of previous ! versions of PostgreSQL. However, ! using OIDs on user tables is not encouraged. Therefore, this ! option will 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 specifically ! require OIDs on certain tables should specify WITH ! OIDS when issuing the CREATE ! TABLE statements for the tables in question. ! ! ! ! ! Platform and Client Compatibility 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 30 Sep 2003 23:35:07 -0000 *************** *** 149,154 **** --- 149,160 ---- of the OID are kept indefinitely. This is semantically similar to the DROP COLUMN process. + + + Note that there is no variant of ALTER TABLE + that allows OIDs to be restored to a table once they have been + removed. + 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 30 Sep 2003 23:46:48 -0000 *************** *** 243,264 **** 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 WITH OIDS is forced even ! if the command says WITHOUT OIDS.) ! Specifying 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 ! WITHOUT OIDS also reduces the space required ! to store the table on disk by 4 bytes per row of the table, ! thereby improving performance. --- 243,272 ---- This optional clause specifies whether rows of the new table ! should have OIDs (object identifiers) assigned to them. If ! neither WITH OIDS nor WITHOUT ! OIDS is specified, the default value depends upon the ! default_use_oids configuration parameter. (If ! the new table inherits from any tables that have OIDs, then ! WITH OIDS is forced even if the command says ! WITHOUT OIDS.) ! If WITHOUT OIDS 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. ! ! ! ! To remove OIDs from a table after it has been created, use . 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 30 Sep 2003 23:44:42 -0000 *************** *** 611,618 **** ! Once restored, it is wise to run ANALYZE on each ! restored table so the optimizer has useful statistics. --- 611,621 ---- ! The dump file produced by pg_dump does ! not contain the statistics used by the optimizer to make query ! planning decisions. Therefore, it is wise to run ! ANALYZE after restoring from a dump file to ! ensure good performance. Index: src/backend/parser/gram.y =================================================================== RCS file: /var/lib/cvs/pgsql-server/src/backend/parser/gram.y,v retrieving revision 2.435 diff -c -r2.435 gram.y *** src/backend/parser/gram.y 26 Sep 2003 15:27:32 -0000 2.435 --- src/backend/parser/gram.y 30 Sep 2003 22:20:28 -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.161 diff -c -r1.161 guc.c *** src/backend/utils/misc/guc.c 29 Sep 2003 00:05:25 -0000 1.161 --- src/backend/utils/misc/guc.c 30 Sep 2003 21:03:42 -0000 *************** *** 123,128 **** --- 123,130 ---- 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; *************** *** 260,266 **** /* 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 */ --- 262,268 ---- /* 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 */ *************** *** 821,826 **** --- 823,836 ---- &add_missing_from, 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.90 diff -c -r1.90 postgresql.conf.sample *** src/backend/utils/misc/postgresql.conf.sample 7 Sep 2003 15:26:54 -0000 1.90 --- src/backend/utils/misc/postgresql.conf.sample 30 Sep 2003 21:07:21 -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 *************** *** 247,252 **** --- 247,253 ---- #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.352 diff -c -r1.352 pg_dump.c *** src/bin/pg_dump/pg_dump.c 27 Sep 2003 22:10:01 -0000 1.352 --- src/bin/pg_dump/pg_dump.c 30 Sep 2003 21:28:18 -0000 *************** *** 5404,5411 **** appendPQExpBuffer(q, ")"); } ! if (!tbinfo->hasoids) ! appendPQExpBuffer(q, " WITHOUT OIDS"); appendPQExpBuffer(q, ";\n"); --- 5404,5410 ---- 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.85 diff -c -r1.85 tab-complete.c *** src/bin/psql/tab-complete.c 7 Sep 2003 15:26:54 -0000 1.85 --- src/bin/psql/tab-complete.c 30 Sep 2003 21:07:58 -0000 *************** *** 516,521 **** --- 516,522 ---- "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 30 Sep 2003 21:02:25 -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;