Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde66987

Browse files
committed
Re-add default_with_oids GUC to avoid breaking old dump files.
After578b229 / the removal of WITH OIDS support, older dump filescontaining SET default_with_oids = false;either report unnecessary errors (as the subsequent tables have nooids) or even fail to restore entirely (when using transaction mode).To avoid that, re-add the GUC, but don't allow setting it to true.Per complaint from Tom Lane.Author: Amit Khandekar, editorialized by meDiscussion:https://postgr.es/m/CAJ3gD9dZyxrtL0rJfoNoOj6v7fJSDaXBngi9wy5XU8m-ioXhAA@mail.gmail.com
1 parent0ad41cf commitde66987

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

‎src/backend/utils/misc/guc.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ static void assign_recovery_target_name(const char *newval, void *extra);
209209
staticboolcheck_recovery_target_lsn(char**newval,void**extra,GucSourcesource);
210210
staticvoidassign_recovery_target_lsn(constchar*newval,void*extra);
211211
staticboolcheck_primary_slot_name(char**newval,void**extra,GucSourcesource);
212+
staticboolcheck_default_with_oids(bool*newval,void**extra,GucSourcesource);
212213

213214
/* Private functions in guc-file.l that need to be called from guc.c */
214215
staticConfigVariable*ProcessConfigFileInternal(GucContextcontext,
@@ -479,6 +480,12 @@ char *event_source;
479480

480481
boolrow_security;
481482
boolcheck_function_bodies= true;
483+
484+
/*
485+
* This GUC exists solely for backward compatibility, check its definition for
486+
* details.
487+
*/
488+
booldefault_with_oids= false;
482489
boolsession_auth_is_superuser;
483490

484491
intlog_min_error_statement=ERROR;
@@ -1538,6 +1545,21 @@ static struct config_bool ConfigureNamesBool[] =
15381545
true,
15391546
NULL,NULL,NULL
15401547
},
1548+
/*
1549+
* WITH OIDS support, and consequently default_with_oids, was removed in
1550+
* PostgreSQL 12, but we tolerate the parameter being set to false to
1551+
* avoid unnecessarily breaking older dump files.
1552+
*/
1553+
{
1554+
{"default_with_oids",PGC_USERSET,COMPAT_OPTIONS_PREVIOUS,
1555+
gettext_noop("WITH OIDS is no longer supported; this can only be false."),
1556+
NULL,
1557+
GUC_NO_SHOW_ALL |GUC_NOT_IN_SAMPLE
1558+
},
1559+
&default_with_oids,
1560+
false,
1561+
check_default_with_oids,NULL,NULL
1562+
},
15411563
{
15421564
{"logging_collector",PGC_POSTMASTER,LOGGING_WHERE,
15431565
gettext_noop("Start a subprocess to capture stderr output and/or csvlogs into log files."),
@@ -11311,4 +11333,19 @@ check_primary_slot_name(char **newval, void **extra, GucSource source)
1131111333
return true;
1131211334
}
1131311335

11336+
staticbool
11337+
check_default_with_oids(bool*newval,void**extra,GucSourcesource)
11338+
{
11339+
if (*newval)
11340+
{
11341+
/* check the GUC's definition for an explanation */
11342+
GUC_check_errcode(ERRCODE_FEATURE_NOT_SUPPORTED);
11343+
GUC_check_errmsg("tables declared WITH OIDS are not supported");
11344+
11345+
return false;
11346+
}
11347+
11348+
return true;
11349+
}
11350+
1131411351
#include"guc-file.c"

‎src/test/regress/expected/guc.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,3 +767,7 @@ NOTICE: text search configuration "no_such_config" does not exist
767767
select func_with_bad_set();
768768
ERROR: invalid value for parameter "default_text_search_config": "no_such_config"
769769
reset check_function_bodies;
770+
set default_with_oids to f;
771+
-- Should not allow to set it to true.
772+
set default_with_oids to t;
773+
ERROR: tables declared WITH OIDS are not supported

‎src/test/regress/sql/guc.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,7 @@ set default_text_search_config = no_such_config;
288288
select func_with_bad_set();
289289

290290
reset check_function_bodies;
291+
292+
set default_with_oids to f;
293+
-- Should not allow to set it to true.
294+
set default_with_oids to t;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp