Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 71E914753A1; Sun, 10 Nov 2002 08:50:33 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id BFCEB474E53; Sun, 10 Nov 2002 08:50:32 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id gAADoPhR008822; Sun, 10 Nov 2002 08:50:25 -0500 (EST) To: "Zhidian Du" Cc: pgsql-php@postgresql.org, pgsql-sql@postgresql.org, sszabo@megazone23.bigpanda.com Subject: Re: [SQL] Parent table has not oid? In-reply-to: References: Comments: In-reply-to "Zhidian Du" message dated "Sat, 09 Nov 2002 23:04:05 -0700" Date: Sun, 10 Nov 2002 08:50:24 -0500 Message-ID: <8821.1036936224@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/53 X-Sequence-Number: 1635 "Zhidian Du" writes: > CREATE TABLE Link ( > Protein_ID oid > CONSTRAINT one > REFERENCES Protein (oid) > ON DELETE CASCADE, > Link varchar(128) > ); > When I insert a record into this child table, it says > "ERROR: constraint one: table protein does not have an attribute oid" How old is your Postgres? IIRC, this was made to work in 7.2 or thereabouts. Note that using OID as a foreign key is not really a good idea, because it's problematic to dump and restore. You'd be better off with a serial column as primary key. regards, tom lane