pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Parent table has not oid?
3+ messages / 3 participants
[nested] [flat]

* Parent table has not oid?
@ 2002-11-10 06:04  Zhidian Du <duzhidian@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Zhidian Du @ 2002-11-10 06:04 UTC (permalink / raw)
  To: pgsql-php@postgresql.org; pgsql-sql; sszabo@megazone23.bigpanda.com





Dear All:

Please disregerd my last email.

I want to create a delete cascade in children tables.  The primary key of 
parent table is oid.


CREATE TABLE Link (
   Protein_ID oid
   CONSTRAINT one
   REFERENCES Protein (oid)
   ON DELETE CASCADE,
   Link varchar(128)
);

Create child table is ok.

When I insert a record into this child table, it says
"ERROR: constraint one: table protein does not have an attribute oid"

Why?


Thanks.


_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] Parent table has not oid?
@ 2002-11-10 13:50  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Zhidian Du <duzhidian@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2002-11-10 13:50 UTC (permalink / raw)
  To: Zhidian Du <duzhidian@hotmail.com>; +Cc: pgsql-php@postgresql.org; pgsql-sql; sszabo@megazone23.bigpanda.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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] Parent table has not oid?
@ 2002-11-12 17:12  scott.marlowe <scott.marlowe@ihs.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: scott.marlowe @ 2002-11-12 17:12 UTC (permalink / raw)
  To: Zhidian Du <duzhidian@hotmail.com>; +Cc: pgsql-php@postgresql.org; pgsql-sql

On Sun, 10 Nov 2002, Tom Lane wrote:

> "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.

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.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-11-12 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-10 06:04 Parent table has not oid? Zhidian Du <duzhidian@hotmail.com>
2002-11-10 13:50 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-11-12 17:12   ` scott.marlowe <scott.marlowe@ihs.com>

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