Re: [SQL] Parent table has not oid?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Zhidian Du" <duzhidian(at)hotmail(dot)com>
Cc: pgsql-php(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org, sszabo(at)megazone23(dot)bigpanda(dot)com
Subject: Re: [SQL] Parent table has not oid?
Date: 2002-11-10 13:50:24
Message-ID: 8821.1036936224@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php pgsql-sql

"Zhidian Du" <duzhidian(at)hotmail(dot)com> 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

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message brew 2002-11-10 14:29:04 Transaction including two web page + timer
Previous Message Zhidian Du 2002-11-10 06:04:05 Parent table has not oid?

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto Mello 2002-11-11 05:17:45 Re: Time difference without intervals
Previous Message Zhidian Du 2002-11-10 06:04:05 Parent table has not oid?