diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 0b4a334..4c135cb 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -10275,6 +10275,7 @@ MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel) * later on, this change will just roll back.) */ childatt->attinhcount++; + childatt->attislocal = false; simple_heap_update(attrrel, &tuple->t_self, tuple); CatalogUpdateIndexes(attrrel, tuple); heap_freetuple(tuple); diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out index 89b6c1c..459f523 100644 --- a/src/test/regress/expected/inherit.out +++ b/src/test/regress/expected/inherit.out @@ -1090,6 +1090,37 @@ Inherits: test_foreign_constraints DROP TABLE test_foreign_constraints_inh; DROP TABLE test_foreign_constraints; DROP TABLE test_primary_constraints; +-- Test for DROP COLUMN +CREATE TABLE p1 (a int , b int); +CREATE TABLE c1 () inherits (p1); +CREATE TABLE c2 (a int , b int); +ALTER TABLE c2 INHERIT p1; +ALTER TABLE p1 DROP COLUMN b; +\d p1 + Table "public.p1" + Column | Type | Modifiers +--------+---------+----------- + a | integer | +Number of child tables: 2 (Use \d+ to list them.) + +\d c1 + Table "public.c1" + Column | Type | Modifiers +--------+---------+----------- + a | integer | +Inherits: p1 + +\d c2 + Table "public.c2" + Column | Type | Modifiers +--------+---------+----------- + a | integer | +Inherits: p1 + +DROP TABLE p1 CASCADE; +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table c1 +drop cascades to table c2 -- -- Test parameterized append plans for inheritance trees -- diff --git a/src/test/regress/sql/inherit.sql b/src/test/regress/sql/inherit.sql index 793c216..bc7ca55 100644 --- a/src/test/regress/sql/inherit.sql +++ b/src/test/regress/sql/inherit.sql @@ -334,6 +334,20 @@ DROP TABLE test_foreign_constraints_inh; DROP TABLE test_foreign_constraints; DROP TABLE test_primary_constraints; +-- Test for DROP COLUMN +CREATE TABLE p1 (a int , b int); +CREATE TABLE c1 () inherits (p1); +CREATE TABLE c2 (a int , b int); + +ALTER TABLE c2 INHERIT p1; +ALTER TABLE p1 DROP COLUMN b; + +\d p1 +\d c1 +\d c2 + +DROP TABLE p1 CASCADE; + -- -- Test parameterized append plans for inheritance trees --