X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30F913A3D2D for ; Tue, 4 Jan 2005 14:56:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22190-03 for ; Tue, 4 Jan 2005 14:56:19 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id AFEC53A3E38 for ; Tue, 4 Jan 2005 14:56:22 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 1F22F35607; Tue, 4 Jan 2005 06:56:22 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 1D97435606; Tue, 4 Jan 2005 06:56:22 -0800 (PST) Date: Tue, 4 Jan 2005 06:56:22 -0800 (PST) From: Stephan Szabo To: "=?iso-8859-2?Q?BARTKO,_Zolt=E1n?=" Cc: pgsql-sql@postgresql.org Subject: Re: foreign key problems In-Reply-To: <200501041215.j04CFe7s017600@www7.pobox.sk> Message-ID: <20050104064025.L6897@megazone.bigpanda.com> References: <200501041215.j04CFe7s017600@www7.pobox.sk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/9 X-Sequence-Number: 19797 On Tue, 4 Jan 2005, [iso-8859-2] BARTKO, Zolt=E1n wrote: > if I create the tables that are in the attached file, I can't insert > rows into the AAttachment table, even though the rows in DObject with > the given primary key exist (PgSQL 8.0 rc1 complains about > (ownerid)=3D(insert the number here) not available in DObject. The same > happens with attribute bodyid). It looks like the set of table definitions you gave in the attached file do not actually work as given, and there's no example data. Running on 8.0 beta3 I was able to insert data that allowed me to place a row into AAttachment (and in fact I actually can insert some data that probably should not be allowed). I'm not sure if that's based on my basically null definition of DRecord or not however. In general, however, foreign keys and inheritance don't mix (neither do primary keys or unique constraints). In general, they'll only currently work for the table they're in specifically and only for the table mentioned specifically. So, for example, the references constraints in AObjAssociation are not inherited by AAttachment. Inheritance really needs someone to champion getting all of these deficiencies fixed.