Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f56C6xE83555 for ; Wed, 6 Jun 2001 08:06:59 -0400 (EDT) (envelope-from pgsql-general-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f51FwOE50429; Fri, 1 Jun 2001 11:58:24 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f51Fcp218508; Fri, 1 Jun 2001 11:38:51 -0400 (EDT) (envelope-from news) From: Dennis Muhlestein X-Newsgroups: comp.databases.postgresql.questions, comp.databases.postgresql.sql Subject: Foreign Keys and Inheritance Followup-To: comp.databases.postgresql.questions Date: Fri, 1 Jun 2001 09:38:48 -0600 Organization: ZServe Lines: 35 Message-ID: <9f8cu9$i29$1@news.tht.net> Reply-To: dennis@zserve.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: scrappy@hub.org User-Agent: KNode/0.4 To: pgsql-general@postgresql.org.pgsql-sql@postgresql.org X-Archive-Number: 200106/179 X-Sequence-Number: 10504 If I have table A, which contains a primary key, and table B which inherits from A. How can I Create a Foreign Key on table C that references A, but will also pass if a record in inserted in to B. for instance: create table A ( prim_key char(20) not null primary key ); create table B ( ) INHERITS A; create table C ( data char(2) not null primary key, constraint fk_C FOREIGN KEY ( data ) REFERENCES A ( prim_key ) ON DELETE CASCADE ON UPDATE CASCADE ) With this setup, my record must be inserted in to A or I'll get a referential integrity problem when I insert in to C. I want to be able to insert in to A, B , or another table inherited from A, and have table C recognize that as it's foreign key. Thanks