Remove sql_inheritance GUC.
authorRobert Haas
Fri, 23 Dec 2016 12:35:01 +0000 (07:35 -0500)
committerRobert Haas
Fri, 23 Dec 2016 12:35:01 +0000 (07:35 -0500)
This backward-compatibility GUC is long overdue for removal.

Discussion: http://postgr.es/m/CA+TgmoYe+EG7LdYX6pkcNxr4ygkP4+A=jm9o-CPXyOvRiCNwaQ@mail.gmail.com

14 files changed:
doc/src/sgml/config.sgml
doc/src/sgml/ddl.sgml
doc/src/sgml/queries.sgml
src/backend/commands/lockcmds.c
src/backend/commands/tablecmds.c
src/backend/nodes/makefuncs.c
src/backend/parser/analyze.c
src/backend/parser/gram.y
src/backend/parser/parse_clause.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample
src/include/nodes/primnodes.h
src/include/parser/parse_clause.h
src/include/utils/guc.h

index b6b20a368ec6353311e9ead67df2aa07ffc9825b..8d7b3bfd663c1ec5071bb93ffb907adfa132d189 100644 (file)
@@ -7394,36 +7394,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
       
      
 
-     
-      sql_inheritance (boolean)
-      
-       sql_inheritance configuration parameter
-      
-      inheritance
-      
-      
-       
-        This setting controls whether undecorated table references are
-        considered to include inheritance child tables.  The default is
-        on, which means child tables are included (thus,
-        a * suffix is assumed by default).  If turned
-        off, child tables are not included (thus, an
-        ONLY prefix is assumed).  The SQL standard
-        requires child tables to be included, so the off setting
-        is not spec-compliant, but it is provided for compatibility with
-        PostgreSQL releases prior to 7.1.
-        See  for more information.
-       
-
-       
-        Turning 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 on.
-       
-      
-     
-
      
       standard_conforming_strings (boolean)
       stringsstandard conforming
index 7e1bc0e5341ebab755885c98d150adeee0bdf60f..d7117cbc8f8d81cb52864cec0d145c007e35a78c 100644 (file)
@@ -2529,11 +2529,9 @@ SELECT name, altitude
     WHERE altitude > 500;
 
 
-   Writing * is not necessary, since this behavior is
-   the default (unless you have changed the setting of the
-    configuration option).
-   However writing * might be useful to emphasize that
-   additional tables will be searched.
+   Writing * is not necessary, since this behavior is always
+   the default.  However, this syntax is still supported for
+   compatibility with older releases where the default could be changed.
   
 
   
index 5cc6dbce11b16b495690f2f22c31fad46327e2e2..0f84c12bec6bfe3f7b96878b2adf56d4826c8c02 100644 (file)
@@ -145,11 +145,9 @@ FROM table_reference table_r
    
     Instead of writing ONLY before the table name, you can write
     * after the table name to explicitly specify that descendant
-    tables are included.  Writing * is not necessary since that
-    behavior is the default (unless you have changed the setting of the 
-    linkend="guc-sql-inheritance"> configuration option).  However writing
-    * might be useful to emphasize that additional tables will be
-    searched.
+    tables are included.  There is no real reason to use this syntax any more,
+    because searching descendent tables is now always the default behavior.
+    However, it is supported for compatibility with older releases.
    
 
    
index 9e62e00b8dc0341d0bc61dcab8e83f1774b4f4a4..ba1414ba645d94f83ac3bb116468a01d42792047 100644 (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,
index ee79b726f2ec831f25edbd7469404ff7b4ee6ed4..13b12f1903530b0d7989e10975e924fa846295c1 100644 (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);
 }
 
index 20e2dbda797515c92ddd8f09a93ef1ce7b8317f6..b64f7c6a8528f86f0fb81972388397d80e9d722f 100644 (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;
index 5e65fe75bd53c747399ccce66c198cd895f6b0b1..601e22abfa3e49a3fa9bc56e4b39e1e44e750874 100644 (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);
 
index 2ed7b5259d0597ffab59319b2390cc8e9135f6ac..931bc9aca68bb94fe0aede51af0569b63ca8fb29 100644 (file)
  *   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 '*'
index 751de4bddb5e7f21b903fcf23f2bd330634cd27a..a96b3f92809f95dcdc5a5652026940a9de09bc0d 100644 (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;
 }
index a02511754e9cd4fd7218fd400ef54b5af0f7a5b6..946ba9e73ebd89caeecff3d05dbc04bfdcce0370 100644 (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\"."),
index 2c638b2c097253b9a0e357b1838009741a846fa4..ee8232f2f40ba59218361a26eea90782286cc027 100644 (file)
 #lo_compat_privileges = off
 #operator_precedence_warning = off
 #quote_all_identifiers = off
-#sql_inheritance = on
 #standard_conforming_strings = on
 #synchronize_seqscans = on
 
index 65510b010bad010aaad283c70ff2afb246b575b3..d11f1120b0ac41982b6c0fd391a6e63bdba713e4 100644 (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 */
index d04ce1125ca745f8d1b67eb8da567f0f071d5da0..549bde43b68d44d808d5354df306ed1b11f1dec0 100644 (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,
index 0bf9f21067824daed538bb6ba477ddfda7686e78..66a3915e8a06094e8c09a22c901c2bf57ef9791b 100644 (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;