]> granicus.if.org Git - postgresql/commitdiff
Small fix for ALTER TABLE xxx* ADD COLUMN ...
authorJan Wieck <JanWieck@Yahoo.com>
Wed, 5 Jul 2000 13:50:59 +0000 (13:50 +0000)
committerJan Wieck <JanWieck@Yahoo.com>
Wed, 5 Jul 2000 13:50:59 +0000 (13:50 +0000)
Inherited child tables must not be open during creation of TOAST table

Jan

src/backend/commands/command.c

index 7c5d4edd8d16ae872d00b24913dcb6038a7cfa0b..af5c49af5eb760419fe491f3ae2b3b81795363ad 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.85 2000/07/05 13:22:23 wieck Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.86 2000/07/05 13:50:59 wieck Exp $
  *
  * NOTES
  *       The PerformAddAttribute() code, like most of the relation
@@ -340,13 +340,17 @@ AlterTableAddColumn(const char *relationName,
                        foreach(child, children)
                        {
                                Oid                     childrelid = lfirsti(child);
+                               char       *childrelname;
 
                                if (childrelid == myrelid)
                                        continue;
                                rel = heap_open(childrelid, AccessExclusiveLock);
-                               AlterTableAddColumn(RelationGetRelationName(rel),
-                                                                       false, colDef);
+                               childrelname = pstrdup(RelationGetRelationName(rel));
                                heap_close(rel, AccessExclusiveLock);
+
+                               AlterTableAddColumn(childrelname, false, colDef);
+
+                               pfree(childrelname);
                        }
                }
        }