1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-22 02:52:08 +03:00

Remove sql_inheritance GUC.

This backward-compatibility GUC is long overdue for removal.

Discussion: http://postgr.es/m/CA+TgmoYe+EG7LdYX6pkcNxr4ygkP4+A=jm9o-CPXyOvRiCNwaQ@mail.gmail.com
This commit is contained in:
Robert Haas
2016-12-23 07:35:01 -05:00
parent 7819ba1ef6
commit e13486eba0
14 changed files with 20 additions and 93 deletions

View File

@ -54,7 +54,7 @@ LockTableCommand(LockStmt *lockstmt)
foreach(p, lockstmt->relations)
{
RangeVar *rv = (RangeVar *) lfirst(p);
bool recurse = interpretInhOption(rv->inhOpt);
bool recurse = (rv->inhOpt == INH_YES);
Oid reloid;
reloid = RangeVarGetRelidExtended(rv, lockstmt->mode, false,

View File

@ -1184,7 +1184,7 @@ ExecuteTruncate(TruncateStmt *stmt)
{
RangeVar *rv = lfirst(cell);
Relation rel;
bool recurse = interpretInhOption(rv->inhOpt);
bool recurse = (rv->inhOpt == INH_YES);
Oid myrelid;
rel = heap_openrv(rv, AccessExclusiveLock);
@ -2655,7 +2655,7 @@ renameatt(RenameStmt *stmt)
renameatt_internal(relid,
stmt->subname, /* old att name */
stmt->newname, /* new att name */
interpretInhOption(stmt->relation->inhOpt), /* recursive? */
(stmt->relation->inhOpt == INH_YES), /* recursive? */
false, /* recursing? */
0, /* expected inhcount */
stmt->behavior);
@ -2807,7 +2807,7 @@ RenameConstraint(RenameStmt *stmt)
rename_constraint_internal(relid, typid,
stmt->subname,
stmt->newname,
stmt->relation ? interpretInhOption(stmt->relation->inhOpt) : false, /* recursive? */
(stmt->relation && stmt->relation->inhOpt == INH_YES), /* recursive? */
false, /* recursing? */
0 /* expected inhcount */ );
@ -3050,7 +3050,7 @@ AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt)
CheckTableNotInUse(rel, "ALTER TABLE");
ATController(stmt,
rel, stmt->cmds, interpretInhOption(stmt->relation->inhOpt),
rel, stmt->cmds, (stmt->relation->inhOpt == INH_YES),
lockmode);
}

View File

@ -423,7 +423,7 @@ makeRangeVar(char *schemaname, char *relname, int location)
r->catalogname = NULL;
r->schemaname = schemaname;
r->relname = relname;
r->inhOpt = INH_DEFAULT;
r->inhOpt = INH_YES;
r->relpersistence = RELPERSISTENCE_PERMANENT;
r->alias = NULL;
r->location = location;

View File

@ -380,7 +380,7 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt)
/* set up range table with just the result rel */
qry->resultRelation = setTargetTable(pstate, stmt->relation,
interpretInhOption(stmt->relation->inhOpt),
(stmt->relation->inhOpt == INH_YES),
true,
ACL_DELETE);
@ -2177,7 +2177,7 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
}
qry->resultRelation = setTargetTable(pstate, stmt->relation,
interpretInhOption(stmt->relation->inhOpt),
(stmt->relation->inhOpt == INH_YES),
true,
ACL_UPDATE);

View File

@ -28,12 +28,11 @@
* current transaction and are just parsing commands to find the next
* ROLLBACK or COMMIT. If you make use of SET variables, then you
* will do the wrong thing in multi-query strings like this:
* SET SQL_inheritance TO off; SELECT * FROM foo;
* SET constraint_exclusion TO off; SELECT * FROM foo;
* because the entire string is parsed by gram.y before the SET gets
* executed. Anything that depends on the database or changeable state
* should be handled during parse analysis so that it happens at the
* right time not the wrong time. The handling of SQL_inheritance is
* a good example.
* right time not the wrong time.
*
* WARNINGS
* If you use a list, make sure the datum is a node so that the printing
@ -11249,9 +11248,9 @@ join_qual: USING '(' name_list ')' { $$ = (Node *) $3; }
relation_expr:
qualified_name
{
/* default inheritance */
/* inheritance query, implicitly */
$$ = $1;
$$->inhOpt = INH_DEFAULT;
$$->inhOpt = INH_YES;
$$->alias = NULL;
}
| qualified_name '*'

View File

@ -228,30 +228,6 @@ setTargetTable(ParseState *pstate, RangeVar *relation,
return rtindex;
}
/*
* Simplify InhOption (yes/no/default) into boolean yes/no.
*
* The reason we do things this way is that we don't want to examine the
* SQL_inheritance option flag until parse_analyze() is run. Otherwise,
* we'd do the wrong thing with query strings that intermix SET commands
* with queries.
*/
bool
interpretInhOption(InhOption inhOpt)
{
switch (inhOpt)
{
case INH_NO:
return false;
case INH_YES:
return true;
case INH_DEFAULT:
return SQL_inheritance;
}
elog(ERROR, "bogus InhOption value: %d", inhOpt);
return false; /* keep compiler quiet */
}
/*
* Given a relation-options list (of DefElems), return true iff the specified
* table/result set should be created with OIDs. This needs to be done after
@ -437,7 +413,7 @@ transformTableEntry(ParseState *pstate, RangeVar *r)
/* We need only build a range table entry */
rte = addRangeTableEntry(pstate, r, r->alias,
interpretInhOption(r->inhOpt), true);
(r->inhOpt == INH_YES), true);
return rte;
}

View File

@ -440,7 +440,6 @@ char *event_source;
bool row_security;
bool check_function_bodies = true;
bool default_with_oids = false;
bool SQL_inheritance = true;
int log_min_error_statement = ERROR;
int log_min_messages = WARNING;
@ -1321,15 +1320,6 @@ static struct config_bool ConfigureNamesBool[] =
false,
NULL, NULL, NULL
},
{
{"sql_inheritance", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
gettext_noop("Causes subtables to be included by default in various commands."),
NULL
},
&SQL_inheritance,
true,
NULL, NULL, NULL
},
{
{"transform_null_equals", PGC_USERSET, COMPAT_OPTIONS_CLIENT,
gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."),

View File

@ -606,7 +606,6 @@
#lo_compat_privileges = off
#operator_precedence_warning = off
#quote_all_identifiers = off
#sql_inheritance = on
#standard_conforming_strings = on
#synchronize_seqscans = on

View File

@ -45,8 +45,7 @@ typedef struct Alias
typedef enum InhOption
{
INH_NO, /* Do NOT scan child tables */
INH_YES, /* DO scan child tables */
INH_DEFAULT /* Use current SQL_inheritance option */
INH_YES /* DO scan child tables */
} InhOption;
/* What to do at commit time for temporary relations */

View File

@ -19,7 +19,6 @@
extern void transformFromClause(ParseState *pstate, List *frmList);
extern int setTargetTable(ParseState *pstate, RangeVar *relation,
bool inh, bool alsoSource, AclMode requiredPerms);
extern bool interpretInhOption(InhOption inhOpt);
extern bool interpretOidsOption(List *defList, bool allowOids);
extern Node *transformWhereClause(ParseState *pstate, Node *clause,

View File

@ -244,7 +244,6 @@ extern bool log_btree_build_stats;
extern PGDLLIMPORT bool check_function_bodies;
extern bool default_with_oids;
extern bool SQL_inheritance;
extern int log_min_error_statement;
extern int log_min_messages;