Thread: Table Inheritance and dropped columns

Table Inheritance and dropped columns

From
Caleb Welton
Date:
Hello,

I'm trying to figure out if this is a bug or a feature.

Two child tables, one created with inheritance, one altered to have
inheritance:
   create table A(a text, b text);   create table A1() inherits (A);   create table A2(a text, b text);   alter table
A2INHERIT A; 

When you drop a column from the parent table only the tables CREATED with
inheritance drop the column:
   alter table A drop column b;
   \d A1        Column | Type | Modifiers       --------+------+-----------        a      | text |       Inherits: a
   \d A2       Column | Type | Modifiers       --------+------+-----------        a      | text |        b      | text
|      Inherits: a 

Is this intended behavior?  I have postgres 8.2.9.

-Caleb



Re: Table Inheritance and dropped columns

From
Tom Lane
Date:
Caleb Welton <cwelton@greenplum.com> writes:
> Two child tables, one created with inheritance, one altered to have
> inheritance:
> When you drop a column from the parent table only the tables CREATED with
> inheritance drop the column:

Yeah, this is intentional.  The other table is presumed to still own its
columns even though it is (perhaps transiently) a child of the parent.
        regards, tom lane