Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 44AC347648F; Tue, 12 Nov 2002 12:27:46 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id 95171476417; Tue, 12 Nov 2002 12:27:40 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gACHQTEa005548; Tue, 12 Nov 2002 10:26:29 -0700 (MST) Date: Tue, 12 Nov 2002 10:12:39 -0700 (MST) From: "scott.marlowe" To: Zhidian Du Cc: , Subject: Re: [SQL] Parent table has not oid? In-Reply-To: <8821.1036936224@sss.pgh.pa.us> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/54 X-Sequence-Number: 1636 On Sun, 10 Nov 2002, Tom Lane wrote: > "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. Yeah, I found that out the hardway and spent a couple days rewriting an app that had used OIDs in a way it really shouldn't have. The only time I use OIDs now is to get rid of duplicate rows by hand or such like that.