Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f5CGQrE38065 for ; Tue, 12 Jun 2001 12:26:53 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from gabuzo.dyn.cheapnet.net (r138m163.cybercable.tm.fr [195.132.138.163]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5A4v9E04518 for ; Sun, 10 Jun 2001 00:57:13 -0400 (EDT) (envelope-from christophe@labouisse.org) Received: by gabuzo.dyn.cheapnet.net (Postfix, from userid 501) id 83DD459E99; Sun, 10 Jun 2001 06:57:03 +0200 (CEST) To: pgsql-sql@postgresql.org Subject: Integrity reference and inheritance From: Christophe Labouisse Date: 10 Jun 2001 06:57:03 +0200 Message-ID: Lines: 34 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200106/180 X-Sequence-Number: 3413 I wanted to build the following schema : - one "generic" document table with a column doc_id ; - a couple of "specific" document tables inheriting from doc ; - a table refering a document by it's id with and integrity constraint on it. In SQL : CREATE TABLE doc ( doc_id serial PRIMARY KEY, ); CREATE TABLE lexique ( ) INHERITS (doc); CREATE TABLE word_doc ( id serial PRIMARY KEY, doc_id int4 NOT NULL CONSTRAINT word_doc_doc_id_ref REFERENCES doc ON DELETE CASCADE, ); What I tried to do next is to insert a new "lexique" entry, and then a bunch of "word_doc" rows refering this entry. The last part fails with a constraint violation this is quite normal since the trigger in backend/utils/adt/ri_triggers.c makes a "SELECT FROM ONLY". What should I do ? Should I consider another way to do what I want, rewrite a trigger to replace the system one ? -- Le cinéma en Lumière : http://www.lumiere.org/ Fingerprint : 4721 651D D309 B302 93E4 5D73 CC52 DF3A E7C7 86CF