Skip to content

Commit 972604e

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
Small fix for ALTER TABLE xxx* ADD COLUMN ...
Inherited child tables must not be open during creation of TOAST table Jan
1 parent 93e1f5d commit 972604e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/backend/commands/command.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.85 2000/07/05 13:22:23 wieck Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.86 2000/07/05 13:50:59 wieck Exp $
1212
*
1313
* NOTES
1414
* The PerformAddAttribute() code, like most of the relation
@@ -340,13 +340,17 @@ AlterTableAddColumn(const char *relationName,
340340
foreach(child, children)
341341
{
342342
Oid childrelid = lfirsti(child);
343+
char *childrelname;
343344

344345
if (childrelid == myrelid)
345346
continue;
346347
rel = heap_open(childrelid, AccessExclusiveLock);
347-
AlterTableAddColumn(RelationGetRelationName(rel),
348-
false, colDef);
348+
childrelname = pstrdup(RelationGetRelationName(rel));
349349
heap_close(rel, AccessExclusiveLock);
350+
351+
AlterTableAddColumn(childrelname, false, colDef);
352+
353+
pfree(childrelname);
350354
}
351355
}
352356
}

0 commit comments

Comments
 (0)