Re: [PATCHES] Inherited Constraints

From: Hannu Krosing <hannu(at)skype(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Inherited Constraints
Date: 2006-03-08 12:53:44
Message-ID: 1141822424.4009.5.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Ühel kenal päeval, E, 2006-03-06 kell 17:25, kirjutas Bruce Momjian:
> Hannu Krosing wrote:
> > ?hel kenal p?eval, E, 2006-03-06 kell 12:12, kirjutas Bruce Momjian:
> > > Added to TODO:
> > >
> > > o Prevent parent tables from altering or dropping constraints
> > > like CHECK that are inherited by child tables
> > >
> > > Dropping constraints should only be possible with CASCADE.
> > >
> > > and we already have this in TODO:
> > >
> > > o %Prevent child tables from altering or dropping constraints
> > > like CHECK that were inherited from the parent table
> > >
> > > so I think we now have all the failure cases documented.
> >
> > If you want to be consistent, then ALTER TABLE ONLY ADD CONSTRAINT ..
> > should also be forbidden, so you can't create non-inherited constraints
>
> I don't have a problem with creating ONLY constraints on parents and
> children. We just don't want them to be removed/modified if they are
> shared.

Well, when you delete a constraint from child, the constraint becomes an
"ONLY" constraint on parent. If you allow ONLY constraints on parents,
then why disallow dropping them from childs ?

IIRC the original complaint about being able to drop constraints from
children was that inherited tables not being bound by constraints on
parents was unexpected/broken.

I.E when you have

CREATE TABLE T(i int check (i>0));

then you would be really surprised by getting -1 out from that table.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2006-03-08 13:09:16 Re: Merge algorithms for large numbers of "tapes"
Previous Message Markus Schaber 2006-03-08 12:07:27 Re: [SQL] Interval subtracting

Browse pgsql-patches by date

  From Date Subject
Next Message Stephen Frost 2006-03-08 13:16:44 Re: CREATE SYNONYM ...
Previous Message Markus Schaber 2006-03-08 12:07:27 Re: [SQL] Interval subtracting