Re: DROP COLUMN misbehaviour with multiple inheritance

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)atentus(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: DROP COLUMN misbehaviour with multiple inheritance
Date: 2002-09-23 08:36:39
Message-ID: 1032770199.10372.22.camel@taru.tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane kirjutas P, 22.09.2002 kell 18:56:
> Alvaro Herrera <alvherre(at)atentus(dot)com> writes:
> >> Another interesting case is multiple inheritance.
> >>
> >> create table p1 (f1 int);
> >> create table p2 (f1 int);
> >> create table c () inherits(p1, p2);
> >>
> >> drop ONLY column p1.f1;
> >> drop column p2.f1;
> >>
> >> After this sequence, what is the state of c.f1? Is it still there?
> >> Should it be?
>
> > Well, in this case the column is dropped. If the last drop is ONLY, the
> > column will stay (regardless of what the first drop did).
>
> 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.

Would it then not produce a situation, which can't be reproduced using
just CREATEs ? i.e. same column in bot parent (p2.f1) and child (c.f1)
but _not_ inherited ??

Then there would be no way to move a field from one parent table to
another and still have it as an inherited column in child.

It also seems bogus considering when doing SELECT * FROM p2 -- How
should the select behave regarding c.f1 - there is a field with the same
name and type but not inherited .

> This would cause the behavior in the above case to be that
> c.f1 stays around after the second drop (but can be dropped with a third
> drop of c.f1 itself).

What if you have a deeper hierarchy under c - will this make you
traverse them all to drop f1 ?

> I think this is correct, since the implication of
> DROP ONLY is that child columns are being cut loose from their parent's
> apron strings and now have independent existence.

From (this) parent's but not from (other) parents' ;)

Like In real world one should only be allowed to disinherit what _he_
owns.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nigel J. Andrews 2002-09-23 09:04:55 Re: PGXLOG variable worthwhile?
Previous Message Alvaro Herrera 2002-09-23 08:30:18 Re: DROP COLUMN misbehaviour with multiple inheritance

Browse pgsql-patches by date

  From Date Subject
Next Message Stephen R. van den Berg 2002-09-23 08:41:48 Re: Implementation of LIMIT on DELETE and UPDATE statements (rel to 7.2.1)
Previous Message Alvaro Herrera 2002-09-23 08:30:18 Re: DROP COLUMN misbehaviour with multiple inheritance