From: Tom Lane <tgl@sss.pgh.pa.us>
To: Zhidian Du <duzhidian@hotmail.com>
Cc: pgsql-php@postgresql.org
Cc: pgsql-sql@postgresql.org
Cc: sszabo@megazone23.bigpanda.com
Subject: Re: [SQL] Parent table has not oid?
Date: Sun, 10 Nov 2002 08:50:24 -0500
Message-ID: <8821.1036936224@sss.pgh.pa.us> (raw)
In-Reply-To: <F61oWoCaNCnFjtCEhgv00004919@hotmail.com>
References: <F61oWoCaNCnFjtCEhgv00004919@hotmail.com>
"Zhidian Du" <duzhidian@hotmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, duzhidian@hotmail.com, pgsql-php@postgresql.org, sszabo@megazone23.bigpanda.com
Subject: Re: [SQL] Parent table has not oid?
In-Reply-To: <8821.1036936224@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox