Re: DROP COLUMN misbehaviour with multiple inheritance - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: DROP COLUMN misbehaviour with multiple inheritance
Date
Msg-id 1032774881.10372.56.camel@taru.tm.ee
Whole thread Raw
In response to Re: DROP COLUMN misbehaviour with multiple inheritance  (Alvaro Herrera <alvherre@atentus.com>)
Responses Re: DROP COLUMN misbehaviour with multiple inheritance  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Alvaro Herrera kirjutas E, 23.09.2002 kell 10:30:
> En 23 Sep 2002 10:23:06 +0200
> Hannu Krosing <hannu@tm.ee> escribió:
>
> > Tom Lane kirjutas P, 22.09.2002 kell 18:56:
>
> > > It seems to me that DROP ONLY should set attislocal true on each child
> > > for which it decrements the inherit count, whether the count reaches
> > > zero or not.
> >
> > This would not be what I e'd expect - if c inherited f1 twice and then
> > one of the parents disinherits it, then it would still be inherited from
> > the other parent
>
> The problem with this is that two sequences of commands only differing
> in the ordering of two clauses give different result:

IMHO this is the correct behaviour

> create table p1 (f1 int, f2 int);
> create table p2 (f1 int, f2 int);
> create table c () inherits (p1, p2);
> alter table only p1 drop column f1;

Here you get rid of f1 in p1 _only_, i.e you keep it in children.

> alter table p2 drop column f1;

At this point c.f1 is inherited from only p2 and should be dropped

> create table p1 (f1 int, f2 int);
> create table p2 (f1 int, f2 int);
> create table c () inherits (p1, p2);
> alter table p2 drop column f1;

Here c.f1 is still inherited from p1 and thus will not be dropped

> alter table only p1 drop column f1;

If you say ONLY you _do_ mean "don't drop from child tables".

> The former drops f1 from c, while the latter does not.  It's
> inconsistent.

But this is what _should_ happen.

It is quite unreasonable to expect that order of commands makes no
difference.

------------
Hannu



pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: DROP COLUMN misbehaviour with multiple inheritance
Next
From: "Nigel J. Andrews"
Date:
Subject: Re: PGXLOG variable worthwhile?