Skip site navigation (1) Skip section navigation (2)

Re: question regarding REFERENCES and INHERITS

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Beatrice Yueksel <beatrice(at)msys(dot)ch>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: question regarding REFERENCES and INHERITS
Date: 2003-03-31 16:37:49
Message-ID: 20030331083401.D35743-100000@megazone23.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-admin
On Mon, 31 Mar 2003, Beatrice Yueksel wrote:

> Hi,
> I made some test with REFERENCES and INHERITS.
> I know from the mailing list that :
> "Referential integrity only applies to the named table and not
> any child tables..."

As a note, this phrase was intended to apply to the target referenced
table (schiff_art in this case).

> I have 3 tables:
> art,
> schiff_admin (for administration with rules, view, etc...)
> schiff (inherits schiff_admin)
>
> There is one reference from schiff_admin to art.
> The reference doesn't work in schiff.
>
> If I add a constraint:
>
> ALTER TABLE schiff_admin
> ADD CONSTRAINT schiff_admin_fk_art
> FOREIGN KEY(art)
> REFERENCES
> schiff_art (art) ON DELETE NO ACTION ;
>
> the reference works also in schiff.
>
> Why the reference is inherited after the "alter table" and not before?

Because inheritance is wierd right now :)  Seriously, the alter table
is appearing to recurse the tree (as of the time the constraint is made),
however create table inherits doesn't make the triggers.  With
pg_constraint in place, that might actually not be as hard now.


In response to

pgsql-admin by date

Next:From: Shankar KDate: 2003-03-31 19:00:03
Subject: bugs / feature list for 7.3.2
Previous:From: Brickley Jeff-RA9607Date: 2003-03-31 16:28:33
Subject: GET ME OFF OF THIS LIST

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group