Re: DROP COLUMN misbehaviour with multiple inheritance

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

Alvaro Herrera kirjutas E, 23.09.2002 kell 10:30:
> En 23 Sep 2002 10:23:06 +0200
> Hannu Krosing <hannu(at)tm(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Roberto Fichera 2002-09-23 10:27:47 Problem on PG7.2.2
Previous Message Hannu Krosing 2002-09-23 09:37:01 Re: DROP COLUMN misbehaviour with multiple inheritance

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-09-23 13:34:22 Re: Implementation of LIMIT on DELETE and UPDATE statements
Previous Message Hannu Krosing 2002-09-23 09:37:01 Re: DROP COLUMN misbehaviour with multiple inheritance