Table Inheritance and dropped columns

Started by Caleb Weltonalmost 17 years ago2 messages
#1Caleb Welton
cwelton@greenplum.com

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 A2 INHERIT 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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Caleb Welton (#1)
Re: Table Inheritance and dropped columns

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