Re: Inheritance of foregn key constraints. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Inheritance of foregn key constraints.
Date
Msg-id 15558.1395411243@sss.pgh.pa.us
Whole thread Raw
In response to Inheritance of foregn key constraints.  (Andrzej Mazurkiewicz <andrzej@mazurkiewicz.org>)
Responses Re: Inheritance of foregn key constraints.  (Andrzej Mazurkiewicz <andrzej@mazurkiewicz.org>)
List pgsql-hackers
Andrzej Mazurkiewicz <andrzej@mazurkiewicz.org> writes:
> My patch need one change that might be of significance.
> A type of the depencencies (pg_depend) among the FK constraint (pg_constraint) 
> and the corresponding "RI_ConstraintTrigger" triggers has to be changed from 
> DEPENDENCY_INTERNAL to DEPENDENCY_AUTO.

So in other words, somebody could (accidentally or maliciously) break the
constraint by dropping one of its implementation triggers.  I doubt that's
acceptable.

> If this modification is not applied, the detail child table cannot be dropped 
> without prevous dropping the whole FK constraint because the removing 
> operation depend on the FK constraint of its parent table.

Dropping a child table is going to have much larger problems than that,
no?  What about the values in the child table --- don't you risk orphaning
referencing rows?  Or are you only supporting this on the referencing
side?

In any case, it seems like DROP TABLE could remove the dependency entries
for itself, rather than taking the risk of weakening the dependency type.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Kohei KaiGai
Date:
Subject: Re: Creating tables for columns
Next
From: Andrew Dunstan
Date:
Subject: Re: QSoC proposal: Rewrite pg_dump and pg_restore