Skip to content

Commit 757b98f

Browse files
committed
Back out Alvaro's patch until regression tests pass.
1 parent c0f7dcd commit 757b98f

File tree

1 file changed

+7
-38
lines changed

1 file changed

+7
-38
lines changed

src/backend/commands/tablecmds.c

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.47 2002/10/19 02:25:51 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.48 2002/10/19 03:01:09 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1643,53 +1643,22 @@ AlterTableAddColumn(Oid myrelid,
16431643
colDefChild->inhcount = 1;
16441644
colDefChild->is_local = false;
16451645

1646-
/* we only need direct inheritors */
1647-
children = find_inheritance_children(myrelid);
1646+
/* this routine is actually in the planner */
1647+
children = find_all_inheritors(myrelid);
16481648

16491649
/*
1650-
* If the child has a column with same name and type,
1651-
* increment its attinhcount and continue. If it has
1652-
* different type, abort. If it doesn't have a column
1653-
* with the same name, add it.
1650+
* find_all_inheritors does the recursive search of the
1651+
* inheritance hierarchy, so all we have to do is process all of
1652+
* the relids in the list that it returns.
16541653
*/
16551654
foreach(child, children)
16561655
{
16571656
Oid childrelid = lfirsti(child);
1658-
HeapTuple tuple;
1659-
Form_pg_attribute childatt;
16601657

16611658
if (childrelid == myrelid)
16621659
continue;
16631660

1664-
attrdesc = heap_openr(AttributeRelationName, RowExclusiveLock);
1665-
tuple = SearchSysCacheCopyAttName(childrelid, colDef->colname);
1666-
if (!HeapTupleIsValid(tuple))
1667-
{
1668-
heap_close(attrdesc, RowExclusiveLock);
1669-
AlterTableAddColumn(childrelid, false, true, colDefChild);
1670-
continue;
1671-
}
1672-
childatt = (Form_pg_attribute) GETSTRUCT(tuple);
1673-
1674-
typeTuple = typenameType(colDef->typename);
1675-
tform = (Form_pg_type) GETSTRUCT(typeTuple);
1676-
1677-
if (HeapTupleGetOid(typeTuple) != childatt->atttypid ||
1678-
colDef->typename->typmod != childatt->atttypmod)
1679-
elog(ERROR, "ALTER TABLE: child table %u has different "
1680-
"type for column \"%s\"",
1681-
childrelid, colDef->colname);
1682-
1683-
childatt->attinhcount++;
1684-
simple_heap_update(attrdesc, &tuple->t_self, tuple);
1685-
CatalogUpdateIndexes(attrdesc, tuple);
1686-
1687-
elog(NOTICE, "ALTER TABLE: merging definition of column "
1688-
"\"%s\" for child %u", colDef->colname, childrelid);
1689-
1690-
heap_close(attrdesc, RowExclusiveLock);
1691-
heap_freetuple(tuple);
1692-
ReleaseSysCache(typeTuple);
1661+
AlterTableAddColumn(childrelid, false, true, colDefChild);
16931662
}
16941663
}
16951664
else

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy