1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

This patch adds a new GUC var, "default_with_oids", which follows the

proposal for eventually deprecating OIDs on user tables that I posted
earlier to pgsql-hackers. pg_dump now always specifies WITH OIDS or
WITHOUT OIDS when dumping a table. The documentation has been updated.

Neil Conway
This commit is contained in:
Bruce Momjian
2003-12-01 22:08:02 +00:00
parent e7ca867485
commit 7ce9b7c0d8
18 changed files with 218 additions and 90 deletions

View File

@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.222 2003/11/29 19:51:48 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.223 2003/12/01 22:07:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -43,6 +43,7 @@
#include "optimizer/var.h"
#include "parser/parsetree.h"
#include "utils/acl.h"
#include "utils/guc.h"
#include "utils/lsyscache.h"
@ -593,11 +594,12 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
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.
* The presence of OIDs in the result set of SELECT INTO is
* controlled by the default_with_oids GUC parameter. The
* behavior in versions of PostgreSQL prior to 7.5 is to
* always include OIDs.
*/
estate->es_force_oids = true;
estate->es_force_oids = default_with_oids;
}
/*

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.440 2003/11/29 19:51:51 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.441 2003/12/01 22:07:58 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -63,6 +63,7 @@
#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 */
@ -1822,7 +1823,12 @@ OptInherit: INHERITS '(' qualified_name_list ')' { $$ = $3; }
OptWithOids:
WITH OIDS { $$ = TRUE; }
| WITHOUT OIDS { $$ = FALSE; }
| /*EMPTY*/ { $$ = TRUE; }
/*
* If the user didn't explicitely specify WITH or WITHOUT
* OIDS, decide whether to include OIDs based on the
* "default_with_oids" GUC var
*/
| /*EMPTY*/ { $$ = default_with_oids; }
;
OnCommitOption: ON COMMIT DROP { $$ = ONCOMMIT_DROP; }

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.173 2003/12/01 03:55:21 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.174 2003/12/01 22:08:00 momjian Exp $
*
*--------------------------------------------------------------------
*/
@ -126,6 +126,8 @@ bool Australian_timezones = false;
bool Password_encryption = true;
bool default_with_oids = true;
int log_min_error_statement = PANIC;
int log_min_messages = NOTICE;
int client_min_messages = NOTICE;
@ -263,7 +265,7 @@ const char *const config_group_names[] =
/* QUERY_TUNING */
gettext_noop("Query Tuning"),
/* QUERY_TUNING_METHOD */
gettext_noop("Query Tuning / Planner Method Enabling"),
gettext_noop("Query Tuning / Planner Method Configuration"),
/* QUERY_TUNING_COST */
gettext_noop("Query Tuning / Planner Cost Constants"),
/* QUERY_TUNING_GEQO */
@ -831,6 +833,14 @@ static struct config_bool ConfigureNamesBool[] =
&check_function_bodies,
true, NULL, NULL
},
{
{"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
},
/* End-of-list marker */
{

View File

@ -100,7 +100,7 @@
# QUERY TUNING
#---------------------------------------------------------------------------
# - Planner Method Enabling -
# - Planner Method Configuration -
#enable_hashagg = true
#enable_hashjoin = true
@ -255,6 +255,7 @@
#add_missing_from = true
#regex_flavor = advanced # advanced, extended, or basic
#sql_inheritance = true
#default_with_oids = true
# - Other Platforms & Clients -

View File

@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.358 2003/11/29 19:52:05 pgsql Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.359 2003/12/01 22:08:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -5627,8 +5627,7 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
appendPQExpBuffer(q, ")");
}
if (!tbinfo->hasoids)
appendPQExpBuffer(q, " WITHOUT OIDS");
appendPQExpBuffer(q, tbinfo->hasoids ? " WITH OIDS" : " WITHOUT OIDS");
appendPQExpBuffer(q, ";\n");

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.94 2003/11/29 19:52:07 pgsql Exp $
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.95 2003/12/01 22:08:01 momjian Exp $
*/
/*----------------------------------------------------------------------
@ -499,6 +499,7 @@ psql_completion(char *text, int start, int end)
"default_statistics_target",
"default_transaction_isolation",
"default_transaction_read_only",
"default_with_oids",
"dynamic_library_path",
"effective_cache_size",
"enable_hashagg",

View File

@ -7,7 +7,7 @@
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.42 2003/11/29 22:41:15 pgsql Exp $
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.43 2003/12/01 22:08:02 momjian Exp $
*--------------------------------------------------------------------
*/
#ifndef GUC_H
@ -109,6 +109,8 @@ extern bool log_btree_build_stats;
extern bool SQL_inheritance;
extern bool Australian_timezones;
extern bool default_with_oids;
extern int log_min_error_statement;
extern int log_min_messages;
extern int client_min_messages;

View File

@ -1,7 +1,7 @@
--
-- WITHOUT OID
--
CREATE TABLE wi (i INT);
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

View File

@ -2,7 +2,7 @@
-- WITHOUT OID
--
CREATE TABLE wi (i INT);
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