Re: [SQL] Parent table has not oid? - Mailing list pgsql-php

From Tom Lane
Subject Re: [SQL] Parent table has not oid?
Date
Msg-id 8821.1036936224@sss.pgh.pa.us
Whole thread Raw
In response to Parent table has not oid?  ("Zhidian Du" <duzhidian@hotmail.com>)
Responses Re: [SQL] Parent table has not oid?  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-php
"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

pgsql-php by date:

Previous
From: "Papp Gyozo"
Date:
Subject: Re: Are these steps correct and standard way to upload
Next
From: "scott.marlowe"
Date:
Subject: Re: [SQL] Parent table has not oid?