mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Re-add default_with_oids GUC to avoid breaking old dump files.
After 578b229718
/ the removal of WITH OIDS support, older dump files
containing
SET default_with_oids = false;
either report unnecessary errors (as the subsequent tables have no
oids) 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 me
Discussion: https://postgr.es/m/CAJ3gD9dZyxrtL0rJfoNoOj6v7fJSDaXBngi9wy5XU8m-ioXhAA@mail.gmail.com
This commit is contained in:
parent
0ad41cf537
commit
de66987adb
@ -209,6 +209,7 @@ static void assign_recovery_target_name(const char *newval, void *extra);
|
||||
static bool check_recovery_target_lsn(char **newval, void **extra, GucSource source);
|
||||
static void assign_recovery_target_lsn(const char *newval, void *extra);
|
||||
static bool check_primary_slot_name(char **newval, void **extra, GucSource source);
|
||||
static bool check_default_with_oids(bool *newval, void **extra, GucSource source);
|
||||
|
||||
/* Private functions in guc-file.l that need to be called from guc.c */
|
||||
static ConfigVariable *ProcessConfigFileInternal(GucContext context,
|
||||
@ -479,6 +480,12 @@ char *event_source;
|
||||
|
||||
bool row_security;
|
||||
bool check_function_bodies = true;
|
||||
|
||||
/*
|
||||
* This GUC exists solely for backward compatibility, check its definition for
|
||||
* details.
|
||||
*/
|
||||
bool default_with_oids = false;
|
||||
bool session_auth_is_superuser;
|
||||
|
||||
int log_min_error_statement = ERROR;
|
||||
@ -1538,6 +1545,21 @@ static struct config_bool ConfigureNamesBool[] =
|
||||
true,
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
/*
|
||||
* WITH OIDS support, and consequently default_with_oids, was removed in
|
||||
* PostgreSQL 12, but we tolerate the parameter being set to false to
|
||||
* avoid unnecessarily breaking older dump files.
|
||||
*/
|
||||
{
|
||||
{"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
|
||||
gettext_noop("WITH OIDS is no longer supported; this can only be false."),
|
||||
NULL,
|
||||
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
|
||||
},
|
||||
&default_with_oids,
|
||||
false,
|
||||
check_default_with_oids, NULL, NULL
|
||||
},
|
||||
{
|
||||
{"logging_collector", PGC_POSTMASTER, LOGGING_WHERE,
|
||||
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)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
check_default_with_oids(bool *newval, void **extra, GucSource source)
|
||||
{
|
||||
if (*newval)
|
||||
{
|
||||
/* check the GUC's definition for an explanation */
|
||||
GUC_check_errcode(ERRCODE_FEATURE_NOT_SUPPORTED);
|
||||
GUC_check_errmsg("tables declared WITH OIDS are not supported");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "guc-file.c"
|
||||
|
@ -767,3 +767,7 @@ NOTICE: text search configuration "no_such_config" does not exist
|
||||
select func_with_bad_set();
|
||||
ERROR: invalid value for parameter "default_text_search_config": "no_such_config"
|
||||
reset check_function_bodies;
|
||||
set default_with_oids to f;
|
||||
-- Should not allow to set it to true.
|
||||
set default_with_oids to t;
|
||||
ERROR: tables declared WITH OIDS are not supported
|
||||
|
@ -288,3 +288,7 @@ set default_text_search_config = no_such_config;
|
||||
select func_with_bad_set();
|
||||
|
||||
reset check_function_bodies;
|
||||
|
||||
set default_with_oids to f;
|
||||
-- Should not allow to set it to true.
|
||||
set default_with_oids to t;
|
||||
|
Loading…
Reference in New Issue
Block a user