Re: Cascaded Column Drop

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Rod Taylor <rbt(at)rbt(dot)ca>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Cascaded Column Drop
Date: 2002-09-27 04:18:46
Message-ID: Pine.LNX.4.44.0209270009490.27017-100000@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian dijo:

> Tom Lane wrote:
> > Rod Taylor <rbt(at)rbt(dot)ca> writes:
> > > When a cascaded column drop is removing the last column, drop the table
> > > instead. Regression tests via domains.
> >
> > Is that a good idea, or should we refuse the drop entirely? A table
> > drop zaps a lot more stuff than a column drop.
>
> I think we should refuse the drop. It is just too strange. You can
> suggest if they want the column dropped, just drop the table.

Yeah... you can't have triggers, you can't have constraints. Hey, you
can create a view using it, and possibly you can inherit the table...
but what's that good for?

But think about the inheritance case again: suppose

create table p (f1 int);
create table c (f2 int) inherits (p);

Now you just change your mind and want to drop p but not c. You can't
do it because f1 is the last column on it, and c inherits it. So a way
to drop the last column inherited (thus freeing the dependency on p)
makes c independent, and you can drop p.

But note that this drop of p is not just drop-cascade: the inheritance
tree has to get out of the dependency info first (it's not drop-restrict
either, is it?)

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"La espina, desde que nace, ya pincha" (Proverbio africano)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-09-27 04:28:56 Re: Cascaded Column Drop
Previous Message Bruce Momjian 2002-09-27 04:16:54 Re: Cascaded Column Drop

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-09-27 04:28:56 Re: Cascaded Column Drop
Previous Message Joe Conway 2002-09-27 04:17:29 additional patch for contrib/tablefunc - added to regression test