Commit e13486eb authored by Robert Haas's avatar Robert Haas

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
parent 7819ba1e
...@@ -7394,36 +7394,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' ...@@ -7394,36 +7394,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry id="guc-sql-inheritance" xreflabel="sql_inheritance">
<term><varname>sql_inheritance</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>sql_inheritance</> configuration parameter</primary>
</indexterm>
<indexterm><primary>inheritance</></>
</term>
<listitem>
<para>
This setting controls whether undecorated table references are
considered to include inheritance child tables. The default is
<literal>on</>, which means child tables are included (thus,
a <literal>*</> suffix is assumed by default). If turned
<literal>off</>, child tables are not included (thus, an
<literal>ONLY</literal> prefix is assumed). The SQL standard
requires child tables to be included, so the <literal>off</> setting
is not spec-compliant, but it is provided for compatibility with
<productname>PostgreSQL</> releases prior to 7.1.
See <xref linkend="ddl-inherit"> for more information.
</para>
<para>
Turning <varname>sql_inheritance</> off is deprecated, because that
behavior has been found to be error-prone as well as contrary to SQL
standard. Discussions of inheritance behavior elsewhere in this
manual generally assume that it is <literal>on</>.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-standard-conforming-strings" xreflabel="standard_conforming_strings"> <varlistentry id="guc-standard-conforming-strings" xreflabel="standard_conforming_strings">
<term><varname>standard_conforming_strings</varname> (<type>boolean</type>) <term><varname>standard_conforming_strings</varname> (<type>boolean</type>)
<indexterm><primary>strings</><secondary>standard conforming</></> <indexterm><primary>strings</><secondary>standard conforming</></>
......
...@@ -2529,11 +2529,9 @@ SELECT name, altitude ...@@ -2529,11 +2529,9 @@ SELECT name, altitude
WHERE altitude &gt; 500; WHERE altitude &gt; 500;
</programlisting> </programlisting>
Writing <literal>*</> is not necessary, since this behavior is Writing <literal>*</> is not necessary, since this behavior is always
the default (unless you have changed the setting of the the default. However, this syntax is still supported for
<xref linkend="guc-sql-inheritance"> configuration option). compatibility with older releases where the default could be changed.
However writing <literal>*</> might be useful to emphasize that
additional tables will be searched.
</para> </para>
<para> <para>
......
...@@ -145,11 +145,9 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -145,11 +145,9 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<para> <para>
Instead of writing <literal>ONLY</> before the table name, you can write Instead of writing <literal>ONLY</> before the table name, you can write
<literal>*</> after the table name to explicitly specify that descendant <literal>*</> after the table name to explicitly specify that descendant
tables are included. Writing <literal>*</> is not necessary since that tables are included. There is no real reason to use this syntax any more,
behavior is the default (unless you have changed the setting of the <xref because searching descendent tables is now always the default behavior.
linkend="guc-sql-inheritance"> configuration option). However writing However, it is supported for compatibility with older releases.
<literal>*</> might be useful to emphasize that additional tables will be
searched.
</para> </para>
<sect3 id="queries-join"> <sect3 id="queries-join">
......
...@@ -54,7 +54,7 @@ LockTableCommand(LockStmt *lockstmt) ...@@ -54,7 +54,7 @@ LockTableCommand(LockStmt *lockstmt)
foreach(p, lockstmt->relations) foreach(p, lockstmt->relations)
{ {
RangeVar *rv = (RangeVar *) lfirst(p); RangeVar *rv = (RangeVar *) lfirst(p);
bool recurse = interpretInhOption(rv->inhOpt); bool recurse = (rv->inhOpt == INH_YES);
Oid reloid; Oid reloid;
reloid = RangeVarGetRelidExtended(rv, lockstmt->mode, false, reloid = RangeVarGetRelidExtended(rv, lockstmt->mode, false,
......
...@@ -1184,7 +1184,7 @@ ExecuteTruncate(TruncateStmt *stmt) ...@@ -1184,7 +1184,7 @@ ExecuteTruncate(TruncateStmt *stmt)
{ {
RangeVar *rv = lfirst(cell); RangeVar *rv = lfirst(cell);
Relation rel; Relation rel;
bool recurse = interpretInhOption(rv->inhOpt); bool recurse = (rv->inhOpt == INH_YES);
Oid myrelid; Oid myrelid;
rel = heap_openrv(rv, AccessExclusiveLock); rel = heap_openrv(rv, AccessExclusiveLock);
...@@ -2655,7 +2655,7 @@ renameatt(RenameStmt *stmt) ...@@ -2655,7 +2655,7 @@ renameatt(RenameStmt *stmt)
renameatt_internal(relid, renameatt_internal(relid,
stmt->subname, /* old att name */ stmt->subname, /* old att name */
stmt->newname, /* new att name */ stmt->newname, /* new att name */
interpretInhOption(stmt->relation->inhOpt), /* recursive? */ (stmt->relation->inhOpt == INH_YES), /* recursive? */
false, /* recursing? */ false, /* recursing? */
0, /* expected inhcount */ 0, /* expected inhcount */
stmt->behavior); stmt->behavior);
...@@ -2807,7 +2807,7 @@ RenameConstraint(RenameStmt *stmt) ...@@ -2807,7 +2807,7 @@ RenameConstraint(RenameStmt *stmt)
rename_constraint_internal(relid, typid, rename_constraint_internal(relid, typid,
stmt->subname, stmt->subname,
stmt->newname, stmt->newname,
stmt->relation ? interpretInhOption(stmt->relation->inhOpt) : false, /* recursive? */ (stmt->relation && stmt->relation->inhOpt == INH_YES), /* recursive? */
false, /* recursing? */ false, /* recursing? */
0 /* expected inhcount */ ); 0 /* expected inhcount */ );
...@@ -3050,7 +3050,7 @@ AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt) ...@@ -3050,7 +3050,7 @@ AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt)
CheckTableNotInUse(rel, "ALTER TABLE"); CheckTableNotInUse(rel, "ALTER TABLE");
ATController(stmt, ATController(stmt,
rel, stmt->cmds, interpretInhOption(stmt->relation->inhOpt), rel, stmt->cmds, (stmt->relation->inhOpt == INH_YES),
lockmode); lockmode);
} }
......
...@@ -423,7 +423,7 @@ makeRangeVar(char *schemaname, char *relname, int location) ...@@ -423,7 +423,7 @@ makeRangeVar(char *schemaname, char *relname, int location)
r->catalogname = NULL; r->catalogname = NULL;
r->schemaname = schemaname; r->schemaname = schemaname;
r->relname = relname; r->relname = relname;
r->inhOpt = INH_DEFAULT; r->inhOpt = INH_YES;
r->relpersistence = RELPERSISTENCE_PERMANENT; r->relpersistence = RELPERSISTENCE_PERMANENT;
r->alias = NULL; r->alias = NULL;
r->location = location; r->location = location;
......
...@@ -380,7 +380,7 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt) ...@@ -380,7 +380,7 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt)
/* set up range table with just the result rel */ /* set up range table with just the result rel */
qry->resultRelation = setTargetTable(pstate, stmt->relation, qry->resultRelation = setTargetTable(pstate, stmt->relation,
interpretInhOption(stmt->relation->inhOpt), (stmt->relation->inhOpt == INH_YES),
true, true,
ACL_DELETE); ACL_DELETE);
...@@ -2177,7 +2177,7 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt) ...@@ -2177,7 +2177,7 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
} }
qry->resultRelation = setTargetTable(pstate, stmt->relation, qry->resultRelation = setTargetTable(pstate, stmt->relation,
interpretInhOption(stmt->relation->inhOpt), (stmt->relation->inhOpt == INH_YES),
true, true,
ACL_UPDATE); ACL_UPDATE);
......
...@@ -28,12 +28,11 @@ ...@@ -28,12 +28,11 @@
* current transaction and are just parsing commands to find the next * current transaction and are just parsing commands to find the next
* ROLLBACK or COMMIT. If you make use of SET variables, then you * ROLLBACK or COMMIT. If you make use of SET variables, then you
* will do the wrong thing in multi-query strings like this: * 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 * because the entire string is parsed by gram.y before the SET gets
* executed. Anything that depends on the database or changeable state * executed. Anything that depends on the database or changeable state
* should be handled during parse analysis so that it happens at the * should be handled during parse analysis so that it happens at the
* right time not the wrong time. The handling of SQL_inheritance is * right time not the wrong time.
* a good example.
* *
* WARNINGS * WARNINGS
* If you use a list, make sure the datum is a node so that the printing * 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; } ...@@ -11249,9 +11248,9 @@ join_qual: USING '(' name_list ')' { $$ = (Node *) $3; }
relation_expr: relation_expr:
qualified_name qualified_name
{ {
/* default inheritance */ /* inheritance query, implicitly */
$$ = $1; $$ = $1;
$$->inhOpt = INH_DEFAULT; $$->inhOpt = INH_YES;
$$->alias = NULL; $$->alias = NULL;
} }
| qualified_name '*' | qualified_name '*'
......
...@@ -228,30 +228,6 @@ setTargetTable(ParseState *pstate, RangeVar *relation, ...@@ -228,30 +228,6 @@ setTargetTable(ParseState *pstate, RangeVar *relation,
return rtindex; 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 * 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 * table/result set should be created with OIDs. This needs to be done after
...@@ -437,7 +413,7 @@ transformTableEntry(ParseState *pstate, RangeVar *r) ...@@ -437,7 +413,7 @@ transformTableEntry(ParseState *pstate, RangeVar *r)
/* We need only build a range table entry */ /* We need only build a range table entry */
rte = addRangeTableEntry(pstate, r, r->alias, rte = addRangeTableEntry(pstate, r, r->alias,
interpretInhOption(r->inhOpt), true); (r->inhOpt == INH_YES), true);
return rte; return rte;
} }
......
...@@ -440,7 +440,6 @@ char *event_source; ...@@ -440,7 +440,6 @@ char *event_source;
bool row_security; bool row_security;
bool check_function_bodies = true; bool check_function_bodies = true;
bool default_with_oids = false; bool default_with_oids = false;
bool SQL_inheritance = true;
int log_min_error_statement = ERROR; int log_min_error_statement = ERROR;
int log_min_messages = WARNING; int log_min_messages = WARNING;
...@@ -1321,15 +1320,6 @@ static struct config_bool ConfigureNamesBool[] = ...@@ -1321,15 +1320,6 @@ static struct config_bool ConfigureNamesBool[] =
false, false,
NULL, NULL, NULL 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, {"transform_null_equals", PGC_USERSET, COMPAT_OPTIONS_CLIENT,
gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."), gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."),
......
...@@ -606,7 +606,6 @@ ...@@ -606,7 +606,6 @@
#lo_compat_privileges = off #lo_compat_privileges = off
#operator_precedence_warning = off #operator_precedence_warning = off
#quote_all_identifiers = off #quote_all_identifiers = off
#sql_inheritance = on
#standard_conforming_strings = on #standard_conforming_strings = on
#synchronize_seqscans = on #synchronize_seqscans = on
......
...@@ -45,8 +45,7 @@ typedef struct Alias ...@@ -45,8 +45,7 @@ typedef struct Alias
typedef enum InhOption typedef enum InhOption
{ {
INH_NO, /* Do NOT scan child tables */ INH_NO, /* Do NOT scan child tables */
INH_YES, /* DO scan child tables */ INH_YES /* DO scan child tables */
INH_DEFAULT /* Use current SQL_inheritance option */
} InhOption; } InhOption;
/* What to do at commit time for temporary relations */ /* What to do at commit time for temporary relations */
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
extern void transformFromClause(ParseState *pstate, List *frmList); extern void transformFromClause(ParseState *pstate, List *frmList);
extern int setTargetTable(ParseState *pstate, RangeVar *relation, extern int setTargetTable(ParseState *pstate, RangeVar *relation,
bool inh, bool alsoSource, AclMode requiredPerms); bool inh, bool alsoSource, AclMode requiredPerms);
extern bool interpretInhOption(InhOption inhOpt);
extern bool interpretOidsOption(List *defList, bool allowOids); extern bool interpretOidsOption(List *defList, bool allowOids);
extern Node *transformWhereClause(ParseState *pstate, Node *clause, extern Node *transformWhereClause(ParseState *pstate, Node *clause,
......
...@@ -244,7 +244,6 @@ extern bool log_btree_build_stats; ...@@ -244,7 +244,6 @@ extern bool log_btree_build_stats;
extern PGDLLIMPORT bool check_function_bodies; extern PGDLLIMPORT bool check_function_bodies;
extern bool default_with_oids; extern bool default_with_oids;
extern bool SQL_inheritance;
extern int log_min_error_statement; extern int log_min_error_statement;
extern int log_min_messages; extern int log_min_messages;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment