Обсуждение: BUG #4291: Inheritance fails on column suppression

Поиск
Список
Период
Сортировка

BUG #4291: Inheritance fails on column suppression

От
"Duprez"
Дата:
The following bug has been logged online:

Bug reference:      4291
Logged by:          Duprez
Email address:      c.duprez@libertysurf.fr
PostgreSQL version: 8.3.3
Operating system:   Windows XP
Description:        Inheritance fails on column suppression
Details:

Hello,

I use Postgresql on Windows XP 8.3.3.
I have created 2 schema, and the tables of the second one inherits the
tables of the first one :

CREATE schema test1;
CREATE schema test2;

CREATE TABLE test1.point (code char(16), test1 char(2), test2 char(3));
CREATE TABLE test2.point (code2 char(16)) INHERITS (test1.point);

Then, I remove th inheritance link by performing an ALTER command :

ALTER TABLE test2.point NO INHERIT test1.point;

And then, I restablish the inheritance :

ALTER TABLE test2.point INHERIT test1.point;

The problem is that, if now I drop a column from the parent table, the
column remains in the child table, whereas the inheritance is established :

ALTER TABLE test1.point DROP COLUMN test2 CASCADE;

The column "test2" remains in "test2.point" table.
According to the documentation, this should not be the case.

Regards,
C. Duprez

Re: BUG #4291: Inheritance fails on column suppression

От
Tom Lane
Дата:
"Duprez" <c.duprez@libertysurf.fr> writes:
> Then, I remove th inheritance link by performing an ALTER command :
> ALTER TABLE test2.point NO INHERIT test1.point;
> And then, I restablish the inheritance :
> ALTER TABLE test2.point INHERIT test1.point;
> The problem is that, if now I drop a column from the parent table, the
> column remains in the child table, whereas the inheritance is established :

This is not a bug.  Once the child was dis-inherited, all its columns
became locally defined, and they'd stay that way on re-inheritance.
(There is no memory in the system that would allow us to determine that
the attislocal flag should be removed --- that is, we can't tell
this case from the case where column test2 was declared locally in
the original child table definition.  It doesn't seem worth adding
still more complexity to the column inheritance state just to cover this.)

> According to the documentation, this should not be the case.

Please state where you think the documentation says that, so we
can fix it.

            regards, tom lane