Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 52C20475D12 for ; Fri, 8 Nov 2002 01:49:35 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id D7139475A71 for ; Fri, 8 Nov 2002 01:49:34 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id B1574D609; Thu, 7 Nov 2002 22:49:34 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id A70655C03; Thu, 7 Nov 2002 22:49:34 -0800 (PST) Date: Thu, 7 Nov 2002 22:49:34 -0800 (PST) From: Stephan Szabo To: Zhidian Du Cc: Subject: Re: No promany key in parent table, how to use delete cascade? In-Reply-To: Message-ID: <20021107224708.K6692-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/126 X-Sequence-Number: 10268 On Thu, 7 Nov 2002, Zhidian Du wrote: > Dear All, > > I want to dreate a delete cascade in children tables. The primary key of > parent table is oid, so when I create parent table, there is no apparetly > key word "primary key". The problem jumps out. > > When I create child table using columnn constraint on delete, the SQL says: > > "PRIMARY KEY for referenced table "parent" not found" > > I do not need to specify the primary key since I am using oid. How can I > get around this problem? I'm not sure if 7.2 lets you make the constraint at all, but even if it does, you need a unique index on oid and you need to specify that the constraint is to oid (col references parent(oid))