OSDN Git Service

Add attisinherited column to pg_attribute; use it to guard against
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Aug 2002 19:23:20 +0000 (19:23 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Aug 2002 19:23:20 +0000 (19:23 +0000)
column additions, deletions, and renames that would let a child table
get out of sync with its parent.  Patch by Alvaro Herrera, with some
kibitzing by Tom Lane.

18 files changed:
doc/src/sgml/catalogs.sgml
src/backend/access/common/tupdesc.c
src/backend/catalog/index.c
src/backend/commands/sequence.c
src/backend/commands/tablecmds.c
src/backend/commands/view.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/tcop/utility.c
src/include/catalog/catversion.h
src/include/catalog/pg_attribute.h
src/include/catalog/pg_class.h
src/include/commands/tablecmds.h
src/include/nodes/parsenodes.h
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql

index a27441a..d1f6f9f 100644 (file)
@@ -1,6 +1,6 @@
 <!--
  Documentation of the system catalogs, directed toward PostgreSQL developers
- $Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.55 2002/08/28 15:02:55 tgl Exp $
+ $Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.56 2002/08/30 19:23:18 tgl Exp $
  -->
 
 <chapter id="catalogs">
       </entry>
      </row>
 
+     <row>
+      <entry>attisinherited</entry>
+      <entry><type>bool</type></entry>
+      <entry></entry>
+      <entry>
+       This column is inherited from some other relation.  An inherited
+       column cannot be dropped nor renamed.
+      </entry>
+     </row>
+
     </tbody>
    </tgroup>
   </table>
index 8637c72..f90717a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.86 2002/08/29 00:17:02 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.87 2002/08/30 19:23:18 tgl Exp $
  *
  * NOTES
  *       some of the executor utility code such as "ExecTypeFromTL" should be
@@ -231,6 +231,9 @@ FreeTupleDesc(TupleDesc tupdesc)
 
 }
 
+/*
+ * Compare two TupleDesc structures for logical equality
+ */
 bool
 equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
 {
@@ -264,8 +267,12 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
                        return false;
                if (attr1->attnotnull != attr2->attnotnull)
                        return false;
+               if (attr1->atthasdef != attr2->atthasdef)
+                       return false;
                if (attr1->attisdropped != attr2->attisdropped)
                        return false;
+               if (attr1->attisinherited != attr2->attisinherited)
+                       return false;
        }
        if (tupdesc1->constr != NULL)
        {
@@ -389,6 +396,7 @@ TupleDescInitEntry(TupleDesc desc,
        att->attnotnull = false;
        att->atthasdef = false;
        att->attisdropped = false;
+       att->attisinherited = false;
 
        tuple = SearchSysCache(TYPEOID,
                                                   ObjectIdGetDatum(oidtypeid),
@@ -514,7 +522,7 @@ BuildDescForRelation(List *schema)
                                                   typenameTypeId(entry->typename),
                                                   atttypmod, attdim, attisset);
 
-               /* This is for constraints */
+               /* Fill in additional stuff not handled by TupleDescInitEntry */
                if (entry->is_not_null)
                        constr->has_not_null = true;
                desc->attrs[attnum - 1]->attnotnull = entry->is_not_null;
@@ -533,7 +541,9 @@ BuildDescForRelation(List *schema)
                        desc->attrs[attnum - 1]->atthasdef = true;
                }
 
+               desc->attrs[attnum - 1]->attisinherited = entry->is_inherited;
        }
+
        if (constr->has_not_null || ndef > 0)
        {
                desc->constr = constr;
index 0aaeaa6..bf6608e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.191 2002/08/29 15:56:19 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.192 2002/08/30 19:23:18 tgl Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -259,6 +259,7 @@ ConstructTupleDescriptor(Relation heapRelation,
                to->attcacheoff = -1;
                to->attnotnull = false;
                to->atthasdef = false;
+               to->attisinherited = false;
 
                /*
                 * We do not yet have the correct relation OID for the index, so
index a33fcd2..3d3f4a9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.84 2002/08/06 02:36:34 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.85 2002/08/30 19:23:19 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -127,6 +127,7 @@ DefineSequence(CreateSeqStmt *seq)
 
                coldef = makeNode(ColumnDef);
                coldef->typename = typnam;
+               coldef->is_inherited = false;
                coldef->is_not_null = true;
                coldef->raw_default = NULL;
                coldef->cooked_default = NULL;
index 04b0266..8529c15 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.36 2002/08/29 00:17:03 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.37 2002/08/30 19:23:19 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,6 +35,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "optimizer/clauses.h"
+#include "optimizer/plancat.h"
 #include "optimizer/planmain.h"
 #include "optimizer/prep.h"
 #include "parser/gramparse.h"
@@ -614,6 +615,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
                                typename->typeid = attribute->atttypid;
                                typename->typmod = attribute->atttypmod;
                                def->typename = typename;
+                               def->is_inherited = true;
                                def->is_not_null = attribute->attnotnull;
                                def->raw_default = NULL;
                                def->cooked_default = NULL;
@@ -1049,14 +1051,16 @@ setRelhassubclassInRelation(Oid relationId, bool relhassubclass)
  *             delete original attribute from attribute catalog
  */
 void
-renameatt(Oid relid,
+renameatt(Oid myrelid,
                  const char *oldattname,
                  const char *newattname,
-                 bool recurse)
+                 bool recurse,
+                 bool recursing)
 {
        Relation        targetrelation;
        Relation        attrelation;
        HeapTuple       atttup;
+       Form_pg_attribute attform;
        List       *indexoidlist;
        List       *indexoidscan;
 
@@ -1064,7 +1068,7 @@ renameatt(Oid relid,
         * Grab an exclusive lock on the target table, which we will NOT
         * release until end of transaction.
         */
-       targetrelation = relation_open(relid, AccessExclusiveLock);
+       targetrelation = relation_open(myrelid, AccessExclusiveLock);
 
        /*
         * permissions checking.  this would normally be done in utility.c,
@@ -1076,7 +1080,7 @@ renameatt(Oid relid,
                && IsSystemRelation(targetrelation))
                elog(ERROR, "renameatt: class \"%s\" is a system catalog",
                         RelationGetRelationName(targetrelation));
-       if (!pg_class_ownercheck(relid, GetUserId()))
+       if (!pg_class_ownercheck(myrelid, GetUserId()))
                aclcheck_error(ACLCHECK_NOT_OWNER,
                                           RelationGetRelationName(targetrelation));
 
@@ -1095,7 +1099,7 @@ renameatt(Oid relid,
                                   *children;
 
                /* this routine is actually in the planner */
-               children = find_all_inheritors(relid);
+               children = find_all_inheritors(myrelid);
 
                /*
                 * find_all_inheritors does the recursive search of the
@@ -1106,34 +1110,53 @@ renameatt(Oid relid,
                {
                        Oid                     childrelid = lfirsti(child);
 
-                       if (childrelid == relid)
+                       if (childrelid == myrelid)
                                continue;
                        /* note we need not recurse again! */
-                       renameatt(childrelid, oldattname, newattname, false);
+                       renameatt(childrelid, oldattname, newattname, false, true);
                }
        }
+       else
+       {
+               /*
+                * If we are told not to recurse, there had better not be any
+                * child tables; else the rename would put them out of step.
+                */
+               if (!recursing &&
+                       find_inheritance_children(myrelid) != NIL)
+                       elog(ERROR, "Inherited attribute \"%s\" must be renamed in child tables too",
+                                oldattname);
+       }
 
        attrelation = heap_openr(AttributeRelationName, RowExclusiveLock);
 
-       atttup = SearchSysCacheCopyAttName(relid, oldattname);
+       atttup = SearchSysCacheCopyAttName(myrelid, oldattname);
        if (!HeapTupleIsValid(atttup))
                elog(ERROR, "renameatt: attribute \"%s\" does not exist",
                         oldattname);
+       attform = (Form_pg_attribute) GETSTRUCT(atttup);
 
-       if (((Form_pg_attribute) GETSTRUCT(atttup))->attnum < 0)
+       if (attform->attnum < 0)
                elog(ERROR, "renameatt: system attribute \"%s\" may not be renamed",
                         oldattname);
 
+       /*
+        * if the attribute is inherited, forbid the renaming, unless we
+        * are already inside a recursive rename.
+        */
+       if (attform->attisinherited && !recursing)
+               elog(ERROR, "renameatt: inherited attribute \"%s\" may not be renamed",
+                        oldattname);
+
        /* should not already exist */
        /* this test is deliberately not attisdropped-aware */
        if (SearchSysCacheExists(ATTNAME,
-                                                        ObjectIdGetDatum(relid),
+                                                        ObjectIdGetDatum(myrelid),
                                                         PointerGetDatum(newattname),
                                                         0, 0))
                elog(ERROR, "renameatt: attribute \"%s\" exists", newattname);
 
-       namestrcpy(&(((Form_pg_attribute) GETSTRUCT(atttup))->attname),
-                          newattname);
+       namestrcpy(&(attform->attname), newattname);
 
        simple_heap_update(attrelation, &atttup->t_self, atttup);
 
@@ -1223,7 +1246,7 @@ renameatt(Oid relid,
  *                       sequence, AFAIK there's no need for it to be there.
  */
 void
-renamerel(Oid relid, const char *newrelname)
+renamerel(Oid myrelid, const char *newrelname)
 {
        Relation        targetrelation;
        Relation        relrelation;    /* for RELATION relation */
@@ -1237,7 +1260,7 @@ renamerel(Oid relid, const char *newrelname)
         * Grab an exclusive lock on the target table or index, which we will
         * NOT release until end of transaction.
         */
-       targetrelation = relation_open(relid, AccessExclusiveLock);
+       targetrelation = relation_open(myrelid, AccessExclusiveLock);
 
        oldrelname = pstrdup(RelationGetRelationName(targetrelation));
        namespaceId = RelationGetNamespace(targetrelation);
@@ -1258,7 +1281,7 @@ renamerel(Oid relid, const char *newrelname)
        relrelation = heap_openr(RelationRelationName, RowExclusiveLock);
 
        reltup = SearchSysCacheCopy(RELOID,
-                                                               PointerGetDatum(relid),
+                                                               PointerGetDatum(myrelid),
                                                                0, 0, 0);
        if (!HeapTupleIsValid(reltup))
                elog(ERROR, "renamerel: relation \"%s\" does not exist",
@@ -1293,12 +1316,12 @@ renamerel(Oid relid, const char *newrelname)
        if (relhastriggers)
        {
                /* update tgargs where relname is primary key */
-               update_ri_trigger_args(relid,
+               update_ri_trigger_args(myrelid,
                                                           oldrelname,
                                                           newrelname,
                                                           false, true);
                /* update tgargs where relname is foreign key */
-               update_ri_trigger_args(relid,
+               update_ri_trigger_args(myrelid,
                                                           oldrelname,
                                                           newrelname,
                                                           true, true);
@@ -1532,35 +1555,12 @@ update_ri_trigger_args(Oid relid,
  *             (formerly known as PerformAddAttribute)
  *
  *             adds an additional attribute to a relation
- *
- *             Adds attribute field(s) to a relation.  Each new attribute
- *             is given attnums in sequential order and is added to the
- *             ATTRIBUTE relation.  If the AMI fails, defunct tuples will
- *             remain in the ATTRIBUTE relation for later vacuuming.
- *             Later, there may be some reserved attribute names???
- *
- *             (If needed, can instead use elog to handle exceptions.)
- *
- *             Note:
- *                             Initial idea of ordering the tuple attributes so that all
- *             the variable length domains occured last was scratched.  Doing
- *             so would not speed access too much (in general) and would create
- *             many complications in formtuple, heap_getattr, and addattribute.
- *
- *             scan attribute catalog for name conflict (within rel)
- *             scan type catalog for absence of data type (if not arg)
- *             create attnum magically???
- *             create attribute tuple
- *             insert attribute in attribute catalog
- *             modify reldesc
- *             create new relation tuple
- *             insert new relation in relation catalog
- *             delete original relation from relation catalog
  * ----------------
  */
 void
 AlterTableAddColumn(Oid myrelid,
-                                       bool inherits,
+                                       bool recurse,
+                                       bool recursing,
                                        ColumnDef *colDef)
 {
        Relation        rel,
@@ -1610,10 +1610,13 @@ AlterTableAddColumn(Oid myrelid,
         * whole transaction to abort, which is what we want -- all or
         * nothing.
         */
-       if (inherits)
+       if (recurse)
        {
                List       *child,
                                   *children;
+               ColumnDef  *colDefChild = copyObject(colDef);
+
+               colDefChild->is_inherited = true;
 
                /* this routine is actually in the planner */
                children = find_all_inheritors(myrelid);
@@ -1630,9 +1633,19 @@ AlterTableAddColumn(Oid myrelid,
                        if (childrelid == myrelid)
                                continue;
 
-                       AlterTableAddColumn(childrelid, false, colDef);
+                       AlterTableAddColumn(childrelid, false, true, colDefChild);
                }
        }
+       else
+       {
+               /*
+                * If we are told not to recurse, there had better not be any
+                * child tables; else the addition would put them out of step.
+                */
+               if (!recursing &&
+                       find_inheritance_children(myrelid) != NIL)
+                       elog(ERROR, "Attribute must be added to child tables too");
+       }
 
        /*
         * OK, get on with it...
@@ -1716,6 +1729,7 @@ AlterTableAddColumn(Oid myrelid,
        attribute->atthasdef = (colDef->raw_default != NULL ||
                                                        colDef->cooked_default != NULL);
        attribute->attisdropped = false;
+       attribute->attisinherited = colDef->is_inherited;
 
        ReleaseSysCache(typeTuple);
 
@@ -1786,8 +1800,8 @@ AlterTableAddColumn(Oid myrelid,
  * ALTER TABLE ALTER COLUMN DROP NOT NULL
  */
 void
-AlterTableAlterColumnDropNotNull(Oid myrelid,
-                                                                bool inh, const char *colName)
+AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
+                                                                const char *colName)
 {
        Relation        rel;
        HeapTuple       tuple;
@@ -1813,7 +1827,7 @@ AlterTableAlterColumnDropNotNull(Oid myrelid,
        /*
         * Propagate to children if desired
         */
-       if (inh)
+       if (recurse)
        {
                List       *child,
                                   *children;
@@ -1920,8 +1934,8 @@ AlterTableAlterColumnDropNotNull(Oid myrelid,
  * ALTER TABLE ALTER COLUMN SET NOT NULL
  */
 void
-AlterTableAlterColumnSetNotNull(Oid myrelid,
-                                                               bool inh, const char *colName)
+AlterTableAlterColumnSetNotNull(Oid myrelid, bool recurse,
+                                                               const char *colName)
 {
        Relation        rel;
        HeapTuple       tuple;
@@ -1947,7 +1961,7 @@ AlterTableAlterColumnSetNotNull(Oid myrelid,
        /*
         * Propagate to children if desired
         */
-       if (inh)
+       if (recurse)
        {
                List       *child,
                                   *children;
@@ -2035,8 +2049,8 @@ AlterTableAlterColumnSetNotNull(Oid myrelid,
  * ALTER TABLE ALTER COLUMN SET/DROP DEFAULT
  */
 void
-AlterTableAlterColumnDefault(Oid myrelid,
-                                                        bool inh, const char *colName,
+AlterTableAlterColumnDefault(Oid myrelid, bool recurse,
+                                                        const char *colName,
                                                         Node *newDefault)
 {
        Relation        rel;
@@ -2065,7 +2079,7 @@ AlterTableAlterColumnDefault(Oid myrelid,
        /*
         * Propagate to children if desired
         */
-       if (inh)
+       if (recurse)
        {
                List       *child,
                                   *children;
@@ -2134,8 +2148,8 @@ AlterTableAlterColumnDefault(Oid myrelid,
  * ALTER TABLE ALTER COLUMN SET STATISTICS / STORAGE
  */
 void
-AlterTableAlterColumnFlags(Oid myrelid,
-                                                  bool inh, const char *colName,
+AlterTableAlterColumnFlags(Oid myrelid, bool recurse,
+                                                  const char *colName,
                                                   Node *flagValue, const char *flagType)
 {
        Relation        rel;
@@ -2213,7 +2227,7 @@ AlterTableAlterColumnFlags(Oid myrelid,
        /*
         * Propagate to children if desired
         */
-       if (inh)
+       if (recurse)
        {
                List       *child,
                                   *children;
@@ -2284,8 +2298,8 @@ AlterTableAlterColumnFlags(Oid myrelid,
  * ALTER TABLE DROP COLUMN
  */
 void
-AlterTableDropColumn(Oid myrelid,
-                                        bool inh, const char *colName,
+AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
+                                        const char *colName,
                                         DropBehavior behavior)
 {
        Relation        rel;
@@ -2344,10 +2358,54 @@ AlterTableDropColumn(Oid myrelid,
                elog(ERROR, "ALTER TABLE: Cannot drop last column from table \"%s\"",
                        RelationGetRelationName(rel));
 
+       /* Don't drop inherited columns */
+       if (tupleDesc->attrs[attnum - 1]->attisinherited && !recursing)
+               elog(ERROR, "ALTER TABLE: Cannot drop inherited column \"%s\"",
+                        colName);
+
+       /*
+        * If we are asked to drop ONLY in this table (no recursion),
+        * we need to mark the inheritors' attribute as non-inherited.
+        */
+       if (!recurse && !recursing)
+       {
+               Relation        attr_rel;
+               List       *child,
+                                  *children;
+
+               /* We only want direct inheritors in this case */
+               children = find_inheritance_children(myrelid);
+
+               attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock);
+               foreach(child, children)
+               {
+                       Oid             childrelid = lfirsti(child);
+                       Relation childrel;
+                       HeapTuple       tuple;
+
+                       childrel = heap_open(childrelid, AccessExclusiveLock);
+
+                       tuple = SearchSysCacheCopyAttName(childrelid, colName);
+                       if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
+                               elog(ERROR, "ALTER TABLE: relation %u has no column \"%s\"",
+                                        childrelid, colName);
+
+                       ((Form_pg_attribute) GETSTRUCT(tuple))->attisinherited = false;
+
+                       simple_heap_update(attr_rel, &tuple->t_self, tuple);
+
+                       /* keep the system catalog indexes current */
+                       CatalogUpdateIndexes(attr_rel, tuple);
+
+                       heap_close(childrel, NoLock);
+               }
+               heap_close(attr_rel, RowExclusiveLock);
+       }
+
        /*
         * Propagate to children if desired
         */
-       if (inh)
+       if (recurse)
        {
                List       *child,
                           *children;
@@ -2366,8 +2424,7 @@ AlterTableDropColumn(Oid myrelid,
 
                        if (childrelid == myrelid)
                                continue;
-                       AlterTableDropColumn(childrelid,
-                                                               false, colName, behavior);
+                       AlterTableDropColumn(childrelid, false, true, colName, behavior);
                }
        }
 
@@ -2388,8 +2445,8 @@ AlterTableDropColumn(Oid myrelid,
  * ALTER TABLE ADD CONSTRAINT
  */
 void
-AlterTableAddConstraint(Oid myrelid,
-                                               bool inh, List *newConstraints)
+AlterTableAddConstraint(Oid myrelid, bool recurse,
+                                               List *newConstraints)
 {
        Relation        rel;
        List       *listptr;
@@ -2413,7 +2470,7 @@ AlterTableAddConstraint(Oid myrelid,
        if (!pg_class_ownercheck(myrelid, GetUserId()))
                aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel));
 
-       if (inh)
+       if (recurse)
        {
                List       *child,
                                   *children;
@@ -3092,8 +3149,8 @@ fkMatchTypeToString(char match_type)
  * ALTER TABLE DROP CONSTRAINT
  */
 void
-AlterTableDropConstraint(Oid myrelid,
-                                                bool inh, const char *constrName,
+AlterTableDropConstraint(Oid myrelid, bool recurse,
+                                                const char *constrName,
                                                 DropBehavior behavior)
 {
        Relation        rel;
@@ -3121,7 +3178,7 @@ AlterTableDropConstraint(Oid myrelid,
        /*
         * Process child tables if requested.
         */
-       if (inh)
+       if (recurse)
        {
                List       *child,
                                   *children;
index faaff48..c635a28 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $Id: view.c,v 1.67 2002/07/16 22:12:19 tgl Exp $
+ *     $Id: view.c,v 1.68 2002/08/30 19:23:19 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -68,6 +68,7 @@ DefineVirtualRelation(const RangeVar *relation, List *tlist)
                        typename->typmod = res->restypmod;
                        def->typename = typename;
 
+                       def->is_inherited = false;
                        def->is_not_null = false;
                        def->raw_default = NULL;
                        def->cooked_default = NULL;
index b3920e3..5b35eea 100644 (file)
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.207 2002/08/27 04:55:07 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.208 2002/08/30 19:23:19 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1729,6 +1729,7 @@ _copyColumnDef(ColumnDef *from)
        if (from->colname)
                newnode->colname = pstrdup(from->colname);
        Node_Copy(from, newnode, typename);
+       newnode->is_inherited = from->is_inherited;
        newnode->is_not_null = from->is_not_null;
        Node_Copy(from, newnode, raw_default);
        if (from->cooked_default)
index 408a94f..7c9127d 100644 (file)
@@ -20,7 +20,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.155 2002/08/27 04:55:07 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.156 2002/08/30 19:23:19 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1748,6 +1748,8 @@ _equalColumnDef(ColumnDef *a, ColumnDef *b)
                return false;
        if (!equal(a->typename, b->typename))
                return false;
+       if (a->is_inherited != b->is_inherited)
+               return false;
        if (a->is_not_null != b->is_not_null)
                return false;
        if (!equal(a->raw_default, b->raw_default))
index ca88b52..a92750c 100644 (file)
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.170 2002/08/29 00:17:04 tgl Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.171 2002/08/30 19:23:19 tgl Exp $
  *
  * NOTES
  *       Every (plan) node in POSTGRES has an associated "out" routine which
@@ -176,7 +176,8 @@ _outColumnDef(StringInfo str, ColumnDef *node)
        _outToken(str, node->colname);
        appendStringInfo(str, " :typename ");
        _outNode(str, node->typename);
-       appendStringInfo(str, " :is_not_null %s :raw_default ",
+       appendStringInfo(str, " :is_inherited %s :is_not_null %s :raw_default ",
+                                        booltostr(node->is_inherited),
                                         booltostr(node->is_not_null));
        _outNode(str, node->raw_default);
        appendStringInfo(str, " :cooked_default ");
index b54a701..2799bb7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.129 2002/08/26 17:53:58 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.130 2002/08/30 19:23:19 tgl Exp $
  *
  * NOTES
  *       Most of the read functions for plan nodes are tested. (In fact, they
@@ -1485,6 +1485,10 @@ _readColumnDef(void)
        token = pg_strtok(&length); /* eat :typename */
        local_node->typename = nodeRead(true); /* now read it */
 
+       token = pg_strtok(&length); /* eat :is_inherited */
+       token = pg_strtok(&length); /* get :is_inherited */
+       local_node->is_inherited = strtobool(token);
+
        token = pg_strtok(&length); /* eat :is_not_null */
        token = pg_strtok(&length); /* get :is_not_null */
        local_node->is_not_null = strtobool(token);
index 65745be..17a2533 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.174 2002/08/29 00:17:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.175 2002/08/30 19:23:20 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -430,7 +430,8 @@ ProcessUtility(Node *parsetree,
                                                renameatt(relid,
                                                                  stmt->oldname,        /* old att name */
                                                                  stmt->newname,        /* new att name */
-                                                                 interpretInhOption(stmt->relation->inhOpt));  /* recursive? */
+                                                                 interpretInhOption(stmt->relation->inhOpt),   /* recursive? */
+                                                                 false);                       /* recursing already? */
                                                break;
                                        case RENAME_TRIGGER:
                                                renametrig(relid,
@@ -470,6 +471,7 @@ ProcessUtility(Node *parsetree,
                                                 */
                                                AlterTableAddColumn(relid,
                                                                                        interpretInhOption(stmt->relation->inhOpt),
+                                                                                       false,
                                                                                        (ColumnDef *) stmt->def);
                                                break;
                                        case 'T':       /* ALTER COLUMN DEFAULT */
@@ -505,13 +507,13 @@ ProcessUtility(Node *parsetree,
                                                                                                   &(stmt->subtype));
                                                break;
                                        case 'D':       /* DROP COLUMN */
-                                               /*
-                                                * XXX We don't actually recurse yet, but what we should do would be:
+                                                /*
                                                 * Recursively drop column from table and,
                                                 * if requested, from descendants
                                                 */
                                                AlterTableDropColumn(relid,
                                                                                         interpretInhOption(stmt->relation->inhOpt),
+                                                                                        false,
                                                                                         stmt->name,
                                                                                         stmt->behavior);
                                                break;
index f122c83..15f8109 100644 (file)
@@ -37,7 +37,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: catversion.h,v 1.154 2002/08/27 04:00:28 momjian Exp $
+ * $Id: catversion.h,v 1.155 2002/08/30 19:23:20 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     200208271
+#define CATALOG_VERSION_NO     200208301
 
 #endif
index 9202d4a..6549622 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_attribute.h,v 1.97 2002/08/08 19:37:11 tgl Exp $
+ * $Id: pg_attribute.h,v 1.98 2002/08/30 19:23:20 tgl Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -146,6 +146,9 @@ CATALOG(pg_attribute) BOOTSTRAP BKI_WITHOUT_OIDS
 
        /* Is dropped (ie, logically invisible) or not */
        bool            attisdropped;
+
+       /* Is inherited from a parent relation */
+       bool            attisinherited;
 } FormData_pg_attribute;
 
 /*
@@ -154,7 +157,7 @@ CATALOG(pg_attribute) BOOTSTRAP BKI_WITHOUT_OIDS
  * because of alignment padding at the end of the struct.)
  */
 #define ATTRIBUTE_TUPLE_SIZE \
-       (offsetof(FormData_pg_attribute,attisdropped) + sizeof(bool))
+       (offsetof(FormData_pg_attribute,attisinherited) + sizeof(bool))
 
 /* ----------------
  *             Form_pg_attribute corresponds to a pointer to a tuple with
@@ -168,7 +171,7 @@ typedef FormData_pg_attribute *Form_pg_attribute;
  * ----------------
  */
 
-#define Natts_pg_attribute                             16
+#define Natts_pg_attribute                             17
 #define Anum_pg_attribute_attrelid             1
 #define Anum_pg_attribute_attname              2
 #define Anum_pg_attribute_atttypid             3
@@ -185,6 +188,7 @@ typedef FormData_pg_attribute *Form_pg_attribute;
 #define Anum_pg_attribute_attnotnull   14
 #define Anum_pg_attribute_atthasdef            15
 #define Anum_pg_attribute_attisdropped 16
+#define Anum_pg_attribute_attisinherited 17
 
 
 
@@ -215,266 +219,268 @@ typedef FormData_pg_attribute *Form_pg_attribute;
  * ----------------
  */
 #define Schema_pg_type \
-{ 1247, {"typname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typnamespace"},  26, -1,     4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typowner"},     23, 0,       4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typlen"},               21, 0,       2,      4, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1247, {"typbyval"},     16, 0,       1,      5, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1247, {"typtype"},      18, -1,      1,      6, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1247, {"typisdefined"},  16, -1,     1,      7, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1247, {"typdelim"},     18, 0,       1,      8, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1247, {"typrelid"},     26, 0,       4,      9, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typelem"},      26, 0,       4, 10, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typinput"},     24, 0,       4, 11, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typoutput"},    24, 0,       4, 12, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typalign"},     18, 0,       1, 13, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1247, {"typstorage"},    18, 0,      1, 14, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1247, {"typnotnull"},    16, 0,   1, 15, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1247, {"typbasetype"},   26, 0,      4, 16, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typtypmod"},     23, 0,      4, 17, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typndims"},      23, 0,      4, 18, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1247, {"typdefaultbin"}, 25, 0,  -1, 19, 0, -1, -1, false, 'x', false, 'i', false, false, false }, \
-{ 1247, {"typdefault"},    25, 0,  -1, 20, 0, -1, -1, false, 'x', false, 'i', false, false, false }
-
-
-DATA(insert ( 1247 typname                     19 -1 NAMEDATALEN   1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1247 typnamespace                26 -1 4   2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 typowner                    23 0  4   3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 typlen                      21 0  2   4 0 -1 -1 t p f s t f f));
-DATA(insert ( 1247 typbyval                    16 0  1   5 0 -1 -1 t p f c t f f));
-DATA(insert ( 1247 typtype                     18 -1 1   6 0 -1 -1 t p f c t f f));
-DATA(insert ( 1247 typisdefined                16 -1 1   7 0 -1 -1 t p f c t f f));
-DATA(insert ( 1247 typdelim                    18 0  1   8 0 -1 -1 t p f c t f f));
-DATA(insert ( 1247 typrelid                    26 0  4   9 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 typelem                     26 0  4  10 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 typinput                    24 0  4  11 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 typoutput           24 0  4  12 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 typalign                    18 0  1  13 0 -1 -1 t p f c t f f));
-DATA(insert ( 1247 typstorage          18 0  1  14 0 -1 -1 t p f c t f f));
-DATA(insert ( 1247 typnotnull          16 0  1  15 0 -1 -1 t p f c t f f));
-DATA(insert ( 1247 typbasetype         26 0  4  16 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 typtypmod           23 0  4  17 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 typndims                    23 0  4  18 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 typdefaultbin       25 0 -1  19 0 -1 -1 f x f i f f f));
-DATA(insert ( 1247 typdefault          25 0 -1  20 0 -1 -1 f x f i f f f));
-DATA(insert ( 1247 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1247 oid                         26 0  4  -2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f));
-DATA(insert ( 1247 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f));
+{ 1247, {"typname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typnamespace"},  26, -1,     4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typowner"},     23, 0,       4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typlen"},               21, 0,       2,      4, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1247, {"typbyval"},     16, 0,       1,      5, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1247, {"typtype"},      18, -1,      1,      6, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1247, {"typisdefined"},  16, -1,     1,      7, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1247, {"typdelim"},     18, 0,       1,      8, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1247, {"typrelid"},     26, 0,       4,      9, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typelem"},      26, 0,       4, 10, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typinput"},     24, 0,       4, 11, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typoutput"},    24, 0,       4, 12, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typalign"},     18, 0,       1, 13, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1247, {"typstorage"},    18, 0,      1, 14, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1247, {"typnotnull"},    16, 0,   1, 15, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1247, {"typbasetype"},   26, 0,      4, 16, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typtypmod"},     23, 0,      4, 17, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typndims"},      23, 0,      4, 18, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typdefaultbin"}, 25, 0,  -1, 19, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }, \
+{ 1247, {"typdefault"},    25, 0,  -1, 20, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }
+
+
+DATA(insert ( 1247 typname                     19 -1 NAMEDATALEN   1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1247 typnamespace                26 -1 4   2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 typowner                    23 0  4   3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 typlen                      21 0  2   4 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1247 typbyval                    16 0  1   5 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1247 typtype                     18 -1 1   6 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1247 typisdefined                16 -1 1   7 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1247 typdelim                    18 0  1   8 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1247 typrelid                    26 0  4   9 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 typelem                     26 0  4  10 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 typinput                    24 0  4  11 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 typoutput           24 0  4  12 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 typalign                    18 0  1  13 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1247 typstorage          18 0  1  14 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1247 typnotnull          16 0  1  15 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1247 typbasetype         26 0  4  16 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 typtypmod           23 0  4  17 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 typndims                    23 0  4  18 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 typdefaultbin       25 0 -1  19 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1247 typdefault          25 0 -1  20 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1247 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1247 oid                         26 0  4  -2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1247 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f f));
 
 /* ----------------
  *             pg_database
  * ----------------
  */
-DATA(insert ( 1262 datname                     19 0 NAMEDATALEN   1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1262 datdba                      23 0  4   2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1262 encoding                    23 0  4   3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1262 datistemplate       16 0  1   4 0 -1 -1 t p f c t f f));
-DATA(insert ( 1262 datallowconn                16 0  1   5 0 -1 -1 t p f c t f f));
-DATA(insert ( 1262 datlastsysoid       26 0  4   6 0 -1 -1 t p f i t f f));
-DATA(insert ( 1262 datvacuumxid                28 0  4   7 0 -1 -1 t p f i t f f));
-DATA(insert ( 1262 datfrozenxid                28 0  4   8 0 -1 -1 t p f i t f f));
+DATA(insert ( 1262 datname                     19 0 NAMEDATALEN   1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1262 datdba                      23 0  4   2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1262 encoding                    23 0  4   3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1262 datistemplate       16 0  1   4 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1262 datallowconn                16 0  1   5 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1262 datlastsysoid       26 0  4   6 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1262 datvacuumxid                28 0  4   7 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1262 datfrozenxid                28 0  4   8 0 -1 -1 t p f i t f f f));
 /* do not mark datpath as toastable; GetRawDatabaseInfo won't cope */
-DATA(insert ( 1262 datpath                     25 0 -1   9 0 -1 -1 f p f i t f f));
-DATA(insert ( 1262 datconfig     1009 0 -1  10 0 -1 -1 f x f i f f f));
-DATA(insert ( 1262 datacl                1034 0 -1  11 0 -1 -1 f x f i f f f));
-DATA(insert ( 1262 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1262 oid                         26 0  4  -2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1262 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1262 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1262 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f));
-DATA(insert ( 1262 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f));
-DATA(insert ( 1262 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f));
+DATA(insert ( 1262 datpath                     25 0 -1   9 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1262 datconfig     1009 0 -1  10 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1262 datacl                1034 0 -1  11 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1262 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1262 oid                         26 0  4  -2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1262 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1262 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1262 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1262 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1262 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f f));
 
 /* ----------------
  *             pg_proc
  * ----------------
  */
 #define Schema_pg_proc \
-{ 1255, {"proname"},                   19, -1, NAMEDATALEN,  1, 0, -1, -1, false, 'p', false, 'i', true, false, false }, \
-{ 1255, {"pronamespace"},              26, -1, 4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1255, {"proowner"},                  23, 0,  4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1255, {"prolang"},                   26, 0,  4,      4, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1255, {"proisagg"},                  16, -1, 1,      5, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1255, {"prosecdef"},                 16, 0,  1,      6, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1255, {"proisstrict"},               16, 0,  1,      7, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1255, {"proretset"},                 16, 0,  1,  8, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1255, {"provolatile"},               18, 0,  1,  9, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1255, {"pronargs"},                  21, 0,  2, 10, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1255, {"prorettype"},                        26, 0,  4, 11, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1255, {"proargtypes"},               30, 0, INDEX_MAX_KEYS*4, 12, 0, -1, -1, false, 'p', false, 'i', true, false, false }, \
-{ 1255, {"prosrc"},                            25, 0, -1, 13, 0, -1, -1, false, 'x', false, 'i', false, false, false }, \
-{ 1255, {"probin"},                            17, 0, -1, 14, 0, -1, -1, false, 'x', false, 'i', false, false, false }, \
-{ 1255, {"proacl"},                      1034, 0, -1, 15, 0, -1, -1, false, 'x', false, 'i', false, false, false }
-
-DATA(insert ( 1255 proname                     19 -1 NAMEDATALEN   1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1255 pronamespace                26 -1 4   2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1255 proowner                    23 0  4   3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1255 prolang                     26 0  4   4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1255 proisagg                    16 -1 1   5 0 -1 -1 t p f c t f f));
-DATA(insert ( 1255 prosecdef           16 0  1   6 0 -1 -1 t p f c t f f));
-DATA(insert ( 1255 proisstrict         16 0  1   7 0 -1 -1 t p f c t f f));
-DATA(insert ( 1255 proretset           16 0  1   8 0 -1 -1 t p f c t f f));
-DATA(insert ( 1255 provolatile         18 0  1   9 0 -1 -1 t p f c t f f));
-DATA(insert ( 1255 pronargs                    21 0  2  10 0 -1 -1 t p f s t f f));
-DATA(insert ( 1255 prorettype          26 0  4  11 0 -1 -1 t p f i t f f));
-DATA(insert ( 1255 proargtypes         30 0 INDEX_MAX_KEYS*4 12 0 -1 -1 f p f i t f f));
-DATA(insert ( 1255 prosrc                      25 0 -1  13 0 -1 -1 f x f i f f f));
-DATA(insert ( 1255 probin                      17 0 -1  14 0 -1 -1 f x f i f f f));
-DATA(insert ( 1255 proacl                1034 0 -1  15 0 -1 -1 f x f i f f f));
-DATA(insert ( 1255 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1255 oid                         26 0  4  -2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1255 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1255 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1255 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f));
-DATA(insert ( 1255 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f));
-DATA(insert ( 1255 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f));
+{ 1255, {"proname"},                   19, -1, NAMEDATALEN,  1, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
+{ 1255, {"pronamespace"},              26, -1, 4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1255, {"proowner"},                  23, 0,  4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1255, {"prolang"},                   26, 0,  4,      4, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1255, {"proisagg"},                  16, -1, 1,      5, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1255, {"prosecdef"},                 16, 0,  1,      6, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1255, {"proisstrict"},               16, 0,  1,      7, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1255, {"proretset"},                 16, 0,  1,  8, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1255, {"provolatile"},               18, 0,  1,  9, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1255, {"pronargs"},                  21, 0,  2, 10, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1255, {"prorettype"},                        26, 0,  4, 11, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1255, {"proargtypes"},               30, 0, INDEX_MAX_KEYS*4, 12, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
+{ 1255, {"prosrc"},                            25, 0, -1, 13, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }, \
+{ 1255, {"probin"},                            17, 0, -1, 14, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }, \
+{ 1255, {"proacl"},                      1034, 0, -1, 15, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }
+
+DATA(insert ( 1255 proname                     19 -1 NAMEDATALEN   1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1255 pronamespace                26 -1 4   2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1255 proowner                    23 0  4   3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1255 prolang                     26 0  4   4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1255 proisagg                    16 -1 1   5 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1255 prosecdef           16 0  1   6 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1255 proisstrict         16 0  1   7 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1255 proretset           16 0  1   8 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1255 provolatile         18 0  1   9 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1255 pronargs                    21 0  2  10 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1255 prorettype          26 0  4  11 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1255 proargtypes         30 0 INDEX_MAX_KEYS*4 12 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1255 prosrc                      25 0 -1  13 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1255 probin                      17 0 -1  14 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1255 proacl                1034 0 -1  15 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1255 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1255 oid                         26 0  4  -2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1255 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1255 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1255 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1255 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1255 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f f));
 
 /* ----------------
  *             pg_shadow
  * ----------------
  */
-DATA(insert ( 1260 usename                     19      -1 NAMEDATALEN  1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1260 usesysid                    23      -1      4       2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1260 usecreatedb         16      0       1       3 0 -1 -1 t p f c t f f));
-DATA(insert ( 1260 usesuper                    16      0       1       4 0 -1 -1 t p f c t f f));
-DATA(insert ( 1260 usecatupd           16      0       1       5 0 -1 -1 t p f c t f f));
-DATA(insert ( 1260 passwd                      25      0  -1   6 0 -1 -1 f x f i f f f));
-DATA(insert ( 1260 valuntil                    702 0   4       7 0 -1 -1 t p f i f f f));
-DATA(insert ( 1260 useconfig     1009  0  -1   8 0 -1 -1 f x f i f f f));
-DATA(insert ( 1260 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f));
+DATA(insert ( 1260 usename                     19      -1 NAMEDATALEN  1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1260 usesysid                    23      -1      4       2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1260 usecreatedb         16      0       1       3 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1260 usesuper                    16      0       1       4 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1260 usecatupd           16      0       1       5 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1260 passwd                      25      0  -1   6 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1260 valuntil                    702 0   4       7 0 -1 -1 t p f i f f f f));
+DATA(insert ( 1260 useconfig     1009  0  -1   8 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1260 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f f));
 /* no OIDs in pg_shadow */
-DATA(insert ( 1260 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1260 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1260 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f));
-DATA(insert ( 1260 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f));
-DATA(insert ( 1260 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f));
+DATA(insert ( 1260 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1260 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1260 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1260 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1260 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f f));
 
 /* ----------------
  *             pg_group
  * ----------------
  */
-DATA(insert ( 1261 groname                     19 -1 NAMEDATALEN  1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1261 grosysid                    23 -1  4   2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1261 grolist               1007 0 -1   3 0 -1 -1 f x f i f f f));
-DATA(insert ( 1261 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f));
+DATA(insert ( 1261 groname                     19 -1 NAMEDATALEN  1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1261 grosysid                    23 -1  4   2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1261 grolist               1007 0 -1   3 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1261 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f f));
 /* no OIDs in pg_group */
-DATA(insert ( 1261 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1261 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1261 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f));
-DATA(insert ( 1261 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f));
-DATA(insert ( 1261 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f));
+DATA(insert ( 1261 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1261 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1261 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1261 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1261 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f f));
 
 /* ----------------
  *             pg_attribute
  * ----------------
  */
 #define Schema_pg_attribute \
-{ 1249, {"attrelid"},    26, -1,       4,      1, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1249, {"attname"},     19, -1, NAMEDATALEN,  2, 0, -1, -1, false, 'p', false, 'i', true, false, false }, \
-{ 1249, {"atttypid"},    26, 0,        4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1249, {"attstattarget"}, 23, 0,      4,      4, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1249, {"attlen"},              21, 0,        2,      5, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1249, {"attnum"},              21, 0,        2,      6, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1249, {"attndims"},    23, 0,        4,      7, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1249, {"attcacheoff"},  23, 0,       4,      8, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1249, {"atttypmod"},   23, 0,        4,      9, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1249, {"attbyval"},    16, 0,        1, 10, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1249, {"attstorage"},   18, 0,       1, 11, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1249, {"attisset"},    16, 0,        1, 12, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1249, {"attalign"},    18, 0,        1, 13, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1249, {"attnotnull"},          16, 0, 1, 14, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1249, {"atthasdef"},   16, 0, 1, 15, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1249, {"attisdropped"}, 16, 0, 1, 16, 0, -1, -1, true, 'p', false, 'c', true, false, false }
-
-DATA(insert ( 1249 attrelid                    26 -1  4   1 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 attname                     19 -1 NAMEDATALEN  2 0 -1 -1 f p f i t f f));
-DATA(insert ( 1249 atttypid                    26 0  4   3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 attstattarget       23 0  4   4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 attlen                      21 0  2   5 0 -1 -1 t p f s t f f));
-DATA(insert ( 1249 attnum                      21 0  2   6 0 -1 -1 t p f s t f f));
-DATA(insert ( 1249 attndims                    23 0  4   7 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 attcacheoff         23 0  4   8 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 atttypmod           23 0  4   9 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 attbyval                    16 0  1  10 0 -1 -1 t p f c t f f));
-DATA(insert ( 1249 attstorage          18 0  1  11 0 -1 -1 t p f c t f f));
-DATA(insert ( 1249 attisset                    16 0  1  12 0 -1 -1 t p f c t f f));
-DATA(insert ( 1249 attalign                    18 0  1  13 0 -1 -1 t p f c t f f));
-DATA(insert ( 1249 attnotnull          16 0  1  14 0 -1 -1 t p f c t f f));
-DATA(insert ( 1249 atthasdef           16 0  1  15 0 -1 -1 t p f c t f f));
-DATA(insert ( 1249 attisdropped                16 0  1  16 0 -1 -1 t p f c t f f));
-DATA(insert ( 1249 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f));
+{ 1249, {"attrelid"},    26, -1,       4,      1, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1249, {"attname"},     19, -1, NAMEDATALEN,  2, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
+{ 1249, {"atttypid"},    26, 0,        4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1249, {"attstattarget"}, 23, 0,      4,      4, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1249, {"attlen"},              21, 0,        2,      5, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1249, {"attnum"},              21, 0,        2,      6, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1249, {"attndims"},    23, 0,        4,      7, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1249, {"attcacheoff"},  23, 0,       4,      8, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1249, {"atttypmod"},   23, 0,        4,      9, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1249, {"attbyval"},    16, 0,        1, 10, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1249, {"attstorage"},   18, 0,       1, 11, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1249, {"attisset"},    16, 0,        1, 12, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1249, {"attalign"},    18, 0,        1, 13, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1249, {"attnotnull"},          16, 0, 1, 14, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1249, {"atthasdef"},   16, 0, 1, 15, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1249, {"attisdropped"}, 16, 0, 1, 16, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1249, {"attisinherited"},16,0, 1, 17, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }
+
+DATA(insert ( 1249 attrelid                    26 -1  4   1 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 attname                     19 -1 NAMEDATALEN  2 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1249 atttypid                    26 0  4   3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 attstattarget       23 0  4   4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 attlen                      21 0  2   5 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1249 attnum                      21 0  2   6 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1249 attndims                    23 0  4   7 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 attcacheoff         23 0  4   8 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 atttypmod           23 0  4   9 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 attbyval                    16 0  1  10 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1249 attstorage          18 0  1  11 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1249 attisset                    16 0  1  12 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1249 attalign                    18 0  1  13 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1249 attnotnull          16 0  1  14 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1249 atthasdef           16 0  1  15 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1249 attisdropped                16 0  1  16 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1249 attisinherited      16 0  1  17 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1249 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f f));
 /* no OIDs in pg_attribute */
-DATA(insert ( 1249 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f));
-DATA(insert ( 1249 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f));
+DATA(insert ( 1249 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1249 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f f));
 
 /* ----------------
  *             pg_class
  * ----------------
  */
 #define Schema_pg_class \
-{ 1259, {"relname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', true, false, false }, \
-{ 1259, {"relnamespace"},  26, -1,     4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1259, {"reltype"},      26, 0,       4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1259, {"relowner"},     23, 0,       4,      4, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1259, {"relam"},                26, 0,       4,      5, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1259, {"relfilenode"},   26, 0,      4,      6, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1259, {"relpages"},     23, 0,       4,      7, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1259, {"reltuples"},    700, 0,      4,      8, 0, -1, -1, false, 'p', false, 'i', true, false, false }, \
-{ 1259, {"reltoastrelid"}, 26, 0,      4,      9, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1259, {"reltoastidxid"}, 26, 0,      4, 10, 0, -1, -1, true, 'p', false, 'i', true, false, false }, \
-{ 1259, {"relhasindex"},   16, 0,      1, 11, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1259, {"relisshared"},   16, 0,      1, 12, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1259, {"relkind"},      18, -1,      1, 13, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1259, {"relnatts"},     21, 0,       2, 14, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1259, {"relchecks"},    21, 0,       2, 15, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1259, {"reltriggers"},   21, 0,      2, 16, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1259, {"relukeys"},     21, 0,       2, 17, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1259, {"relfkeys"},     21, 0,       2, 18, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1259, {"relrefs"},      21, 0,       2, 19, 0, -1, -1, true, 'p', false, 's', true, false, false }, \
-{ 1259, {"relhasoids"},    16, 0,      1, 20, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1259, {"relhaspkey"},    16, 0,      1, 21, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1259, {"relhasrules"},   16, 0,      1, 22, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1259, {"relhassubclass"},16, 0,      1, 23, 0, -1, -1, true, 'p', false, 'c', true, false, false }, \
-{ 1259, {"relacl"},             1034, 0,  -1, 24, 0, -1, -1, false, 'x', false, 'i', false, false, false }
-
-DATA(insert ( 1259 relname                     19 -1 NAMEDATALEN   1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1259 relnamespace                26 -1 4   2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 reltype                     26 0  4   3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 relowner                    23 0  4   4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 relam                       26 0  4   5 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 relfilenode         26 0  4   6 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 relpages                    23 0  4   7 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 reltuples      700 0  4   8 0 -1 -1 f p f i t f f));
-DATA(insert ( 1259 reltoastrelid       26 0  4   9 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 reltoastidxid       26 0  4  10 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 relhasindex         16 0  1  11 0 -1 -1 t p f c t f f));
-DATA(insert ( 1259 relisshared         16 0  1  12 0 -1 -1 t p f c t f f));
-DATA(insert ( 1259 relkind                     18 -1 1  13 0 -1 -1 t p f c t f f));
-DATA(insert ( 1259 relnatts                    21 0  2  14 0 -1 -1 t p f s t f f));
-DATA(insert ( 1259 relchecks           21 0  2  15 0 -1 -1 t p f s t f f));
-DATA(insert ( 1259 reltriggers         21 0  2  16 0 -1 -1 t p f s t f f));
-DATA(insert ( 1259 relukeys                    21 0  2  17 0 -1 -1 t p f s t f f));
-DATA(insert ( 1259 relfkeys                    21 0  2  18 0 -1 -1 t p f s t f f));
-DATA(insert ( 1259 relrefs                     21 0  2  19 0 -1 -1 t p f s t f f));
-DATA(insert ( 1259 relhasoids          16 0  1  20 0 -1 -1 t p f c t f f));
-DATA(insert ( 1259 relhaspkey          16 0  1  21 0 -1 -1 t p f c t f f));
-DATA(insert ( 1259 relhasrules         16 0  1  22 0 -1 -1 t p f c t f f));
-DATA(insert ( 1259 relhassubclass      16 0  1  23 0 -1 -1 t p f c t f f));
-DATA(insert ( 1259 relacl                1034 0 -1  24 0 -1 -1 f x f i f f f));
-DATA(insert ( 1259 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f));
-DATA(insert ( 1259 oid                         26 0  4  -2 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f));
-DATA(insert ( 1259 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f));
+{ 1259, {"relname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"relnamespace"},  26, -1,     4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"reltype"},      26, 0,       4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"relowner"},     23, 0,       4,      4, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"relam"},                26, 0,       4,      5, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"relfilenode"},   26, 0,      4,      6, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"relpages"},     23, 0,       4,      7, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"reltuples"},    700, 0,      4,      8, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"reltoastrelid"}, 26, 0,      4,      9, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"reltoastidxid"}, 26, 0,      4, 10, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"relhasindex"},   16, 0,      1, 11, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1259, {"relisshared"},   16, 0,      1, 12, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1259, {"relkind"},      18, -1,      1, 13, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1259, {"relnatts"},     21, 0,       2, 14, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1259, {"relchecks"},    21, 0,       2, 15, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1259, {"reltriggers"},   21, 0,      2, 16, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1259, {"relukeys"},     21, 0,       2, 17, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1259, {"relfkeys"},     21, 0,       2, 18, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1259, {"relrefs"},      21, 0,       2, 19, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
+{ 1259, {"relhasoids"},    16, 0,      1, 20, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1259, {"relhaspkey"},    16, 0,      1, 21, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1259, {"relhasrules"},   16, 0,      1, 22, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1259, {"relhassubclass"},16, 0,      1, 23, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1259, {"relacl"},             1034, 0,  -1, 24, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }
+
+DATA(insert ( 1259 relname                     19 -1 NAMEDATALEN   1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1259 relnamespace                26 -1 4   2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 reltype                     26 0  4   3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 relowner                    23 0  4   4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 relam                       26 0  4   5 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 relfilenode         26 0  4   6 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 relpages                    23 0  4   7 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 reltuples      700 0  4   8 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1259 reltoastrelid       26 0  4   9 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 reltoastidxid       26 0  4  10 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 relhasindex         16 0  1  11 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1259 relisshared         16 0  1  12 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1259 relkind                     18 -1 1  13 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1259 relnatts                    21 0  2  14 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1259 relchecks           21 0  2  15 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1259 reltriggers         21 0  2  16 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1259 relukeys                    21 0  2  17 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1259 relfkeys                    21 0  2  18 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1259 relrefs                     21 0  2  19 0 -1 -1 t p f s t f f f));
+DATA(insert ( 1259 relhasoids          16 0  1  20 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1259 relhaspkey          16 0  1  21 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1259 relhasrules         16 0  1  22 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1259 relhassubclass      16 0  1  23 0 -1 -1 t p f c t f f f));
+DATA(insert ( 1259 relacl                1034 0 -1  24 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1259 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1259 oid                         26 0  4  -2 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 cmin                                29 0  4  -4 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 xmax                                28 0  4  -5 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 cmax                                29 0  4  -6 0 -1 -1 t p f i t f f f));
+DATA(insert ( 1259 tableoid                    26 0  4  -7 0 -1 -1 t p f i t f f f));
 
 /* ----------------
  *             pg_xactlock - this is not a real relation, but is a placeholder
@@ -484,6 +490,6 @@ DATA(insert ( 1259 tableoid                 26 0  4  -7 0 -1 -1 t p f i t f f));
  *                               table; and this entry is just to link to that one.
  * ----------------
  */
-DATA(insert ( 376 xactlockfoo          26 0  4   1 0 -1 -1 t p f i t f f));
+DATA(insert ( 376 xactlockfoo          26 0  4   1 0 -1 -1 t p f i t f f f));
 
 #endif   /* PG_ATTRIBUTE_H */
index fd4ffac..466177f 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_class.h,v 1.71 2002/08/15 16:36:07 momjian Exp $
+ * $Id: pg_class.h,v 1.72 2002/08/30 19:23:20 tgl Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -136,7 +136,7 @@ typedef FormData_pg_class *Form_pg_class;
 
 DATA(insert OID = 1247 (  pg_type              PGNSP 71 PGUID 0 1247 0 0 0 0 f f r 20 0 0 0 0 0 t f f f _null_ ));
 DESCR("");
-DATA(insert OID = 1249 (  pg_attribute PGNSP 75 PGUID 0 1249 0 0 0 0 f f r 16 0 0 0 0 0 f f f f _null_ ));
+DATA(insert OID = 1249 (  pg_attribute PGNSP 75 PGUID 0 1249 0 0 0 0 f f r 17 0 0 0 0 0 f f f f _null_ ));
 DESCR("");
 DATA(insert OID = 1255 (  pg_proc              PGNSP 81 PGUID 0 1255 0 0 0 0 f f r 15 0 0 0 0 0 t f f f _null_ ));
 DESCR("");
index d38ea53..481a07e 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tablecmds.h,v 1.5 2002/07/01 15:27:56 tgl Exp $
+ * $Id: tablecmds.h,v 1.6 2002/08/30 19:23:20 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include "nodes/parsenodes.h"
 
-extern void AlterTableAddColumn(Oid myrelid, bool inherits,
+extern void AlterTableAddColumn(Oid myrelid, bool recurse, bool recursing,
                                                                ColumnDef *colDef);
 
-extern void AlterTableAlterColumnDefault(Oid myrelid, bool inh,
-                                                                                const char *colName,
-                                                                                Node *newDefault);
-
-extern void AlterTableAlterColumnDropNotNull(Oid myrelid, bool inh,
+extern void AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
                                                                                         const char *colName);
 
-extern void AlterTableAlterColumnSetNotNull(Oid myrelid, bool inh,
+extern void AlterTableAlterColumnSetNotNull(Oid myrelid, bool recurse,
                                                                                        const char *colName);
 
-extern void AlterTableAlterColumnFlags(Oid myrelid, bool inh,
+extern void AlterTableAlterColumnDefault(Oid myrelid, bool recurse,
+                                                                                const char *colName,
+                                                                                Node *newDefault);
+
+extern void AlterTableAlterColumnFlags(Oid myrelid, bool recurse,
                                                                           const char *colName,
                                                                           Node *flagValue, const char *flagType);
 
-extern void AlterTableDropColumn(Oid myrelid, bool inh,
+extern void AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
                                                                 const char *colName,
                                                                 DropBehavior behavior);
 
-extern void AlterTableAddConstraint(Oid myrelid, bool inh,
+extern void AlterTableAddConstraint(Oid myrelid, bool recurse,
                                                                        List *newConstraints);
 
-extern void AlterTableDropConstraint(Oid myrelid, bool inh,
+extern void AlterTableDropConstraint(Oid myrelid, bool recurse,
                                                                         const char *constrName,
                                                                         DropBehavior behavior);
 
@@ -54,12 +54,13 @@ extern void RemoveRelation(const RangeVar *relation, DropBehavior behavior);
 
 extern void TruncateRelation(const RangeVar *relation);
 
-extern void renameatt(Oid relid,
+extern void renameatt(Oid myrelid,
                  const char *oldattname,
                  const char *newattname,
-                 bool recurse);
+                 bool recurse,
+                 bool recursing);
 
-extern void renamerel(Oid relid,
+extern void renamerel(Oid myrelid,
                  const char *newrelname);
 
 #endif   /* TABLECMDS_H */
index 25ec8a3..19d52d7 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.202 2002/08/27 04:55:12 tgl Exp $
+ * $Id: parsenodes.h,v 1.203 2002/08/30 19:23:20 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -279,6 +279,7 @@ typedef struct ColumnDef
        NodeTag         type;
        char       *colname;            /* name of column */
        TypeName   *typename;           /* type of column */
+       bool            is_inherited;   /* column is inherited? */
        bool            is_not_null;    /* NOT NULL constraint specified? */
        Node       *raw_default;        /* default value (untransformed parse
                                                                 * tree) */
index b02aba5..3cd121a 100644 (file)
@@ -1023,3 +1023,34 @@ select * from test;
 (3 rows)
 
 drop table test;
+-- test inheritance
+create table dropColumn (a int, b int, e int);
+create table dropColumnChild (c int) inherits (dropColumn);
+create table dropColumnAnother (d int) inherits (dropColumnChild);
+-- these two should fail
+alter table dropColumnchild drop column a;
+ERROR:  ALTER TABLE: Cannot drop inherited column "a"
+alter table only dropColumnChild drop column b;
+ERROR:  ALTER TABLE: Cannot drop inherited column "b"
+-- these three should work
+alter table only dropColumn drop column e;
+alter table dropColumnChild drop column c;
+alter table dropColumn drop column a;
+create table renameColumn (a int);
+create table renameColumnChild (b int) inherits (renameColumn);
+create table renameColumnAnother (c int) inherits (renameColumnChild);
+-- these three should fail
+alter table renameColumnChild rename column a to d;
+ERROR:  renameatt: inherited attribute "a" may not be renamed
+alter table only renameColumnChild rename column a to d;
+ERROR:  Inherited attribute "a" must be renamed in child tables too
+alter table only renameColumn rename column a to d;
+ERROR:  Inherited attribute "a" must be renamed in child tables too
+-- these should work
+alter table renameColumn rename column a to d;
+alter table renameColumnChild rename column b to a;
+-- this should work
+alter table renameColumn add column w int;
+-- this should fail
+alter table only renameColumn add column x int;
+ERROR:  Attribute must be added to child tables too
index 6eaae24..a5b6bd8 100644 (file)
@@ -731,3 +731,36 @@ copy test(b,c) from stdin;
 select * from test;
 drop table test;
 
+-- test inheritance
+
+create table dropColumn (a int, b int, e int);
+create table dropColumnChild (c int) inherits (dropColumn);
+create table dropColumnAnother (d int) inherits (dropColumnChild);
+
+-- these two should fail
+alter table dropColumnchild drop column a;
+alter table only dropColumnChild drop column b;
+
+-- these three should work
+alter table only dropColumn drop column e;
+alter table dropColumnChild drop column c;
+alter table dropColumn drop column a;
+
+create table renameColumn (a int);
+create table renameColumnChild (b int) inherits (renameColumn);
+create table renameColumnAnother (c int) inherits (renameColumnChild);
+
+-- these three should fail
+alter table renameColumnChild rename column a to d;
+alter table only renameColumnChild rename column a to d;
+alter table only renameColumn rename column a to d;
+
+-- these should work
+alter table renameColumn rename column a to d;
+alter table renameColumnChild rename column b to a;
+
+-- this should work
+alter table renameColumn add column w int;
+
+-- this should fail
+alter table only renameColumn add column x int;