X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3E241476141 for ; Mon, 31 Mar 2003 11:37:53 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id DF9C4475F6A for ; Mon, 31 Mar 2003 11:37:44 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 8FAE2D618; Mon, 31 Mar 2003 08:37:49 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 856305C0C; Mon, 31 Mar 2003 08:37:49 -0800 (PST) Date: Mon, 31 Mar 2003 08:37:49 -0800 (PST) From: Stephan Szabo To: Beatrice Yueksel Cc: Subject: Re: question regarding REFERENCES and INHERITS In-Reply-To: <3E881322.7050403@msys.ch> Message-ID: <20030331083401.D35743-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-26.0 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/509 X-Sequence-Number: 8149 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.