Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6cb74a6

Browse files
committed
revert "Throw error for ALTER TABLE RESET of an invalid option"
Reverts commits 73d78e1 and b0488e5. Also reverts pg_upgrade changes.
1 parent 2209b39 commit 6cb74a6

File tree

2 files changed

+1
-36
lines changed

2 files changed

+1
-36
lines changed

contrib/pg_upgrade/dump.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ optionally_create_toast_tables(void)
115115
"c.relkind IN ('r', 'm') AND "
116116
"c.reltoastrelid = 0");
117117

118-
/* Suppress NOTICE output from non-existant constraints */
119-
PQclear(executeQueryOrDie(conn, "SET client_min_messages = warning;"));
120-
PQclear(executeQueryOrDie(conn, "SET log_min_messages = warning;"));
121-
PQclear(executeQueryOrDie(conn, "SET log_min_error_statement = warning;"));
122-
123118
ntups = PQntuples(res);
124119
i_nspname = PQfnumber(res, "nspname");
125120
i_relname = PQfnumber(res, "relname");
@@ -130,17 +125,13 @@ optionally_create_toast_tables(void)
130125
OPTIONALLY_CREATE_TOAST_OID));
131126

132127
/* dummy command that also triggers check for required TOAST table */
133-
PQclear(executeQueryOrDie(conn, "ALTER TABLE %s.%s DROP CONSTRAINT IF EXISTS binary_upgrade_dummy_constraint;",
128+
PQclear(executeQueryOrDie(conn, "ALTER TABLE %s.%s RESET (binary_upgrade_dummy_option);",
134129
quote_identifier(PQgetvalue(res, rowno, i_nspname)),
135130
quote_identifier(PQgetvalue(res, rowno, i_relname))));
136131
}
137132

138133
PQclear(res);
139134

140-
PQclear(executeQueryOrDie(conn, "RESET client_min_messages;"));
141-
PQclear(executeQueryOrDie(conn, "RESET log_min_messages;"));
142-
PQclear(executeQueryOrDie(conn, "RESET log_min_error_statement;"));
143-
144135
PQfinish(conn);
145136
}
146137

src/backend/access/common/reloptions.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,6 @@ static void initialize_reloptions(void);
307307
static void parse_one_reloption(relopt_value *option, char *text_str,
308308
int text_len, bool validate);
309309

310-
static bool is_valid_reloption(char *name);
311-
312310
/*
313311
* initialize_reloptions
314312
* initialization routine, must be called before parsing
@@ -383,25 +381,6 @@ initialize_reloptions(void)
383381
need_initialization = false;
384382
}
385383

386-
/*
387-
* is_valid_reloption
388-
* check if a reloption exists
389-
*
390-
*/
391-
static bool
392-
is_valid_reloption(char *name)
393-
{
394-
int i;
395-
396-
for (i = 0; relOpts[i]; i++)
397-
{
398-
if (pg_strcasecmp(relOpts[i]->name, name) == 0)
399-
return true;
400-
}
401-
402-
return false;
403-
}
404-
405384
/*
406385
* add_reloption_kind
407386
* Create a new relopt_kind value, to be used in custom reloptions by
@@ -693,11 +672,6 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace,
693672

694673
if (isReset)
695674
{
696-
if (!is_valid_reloption(def->defname))
697-
ereport(ERROR,
698-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
699-
errmsg("unrecognized parameter \"%s\"", def->defname)));
700-
701675
if (def->arg != NULL)
702676
ereport(ERROR,
703677
(errcode(ERRCODE_SYNTAX_ERROR),

0 commit comments

Comments
 (0)