pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
No promany key in parent table, how to use delete cascade?
2+ messages / 2 participants
[nested] [flat]

* No promany key in parent table, how to use delete cascade?
@ 2002-11-08 06:19  Zhidian Du <duzhidian@hotmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Zhidian Du @ 2002-11-08 06:19 UTC (permalink / raw)
  To: pgsql-sql

Dear All,

I want to dreate a delete cascade in children tables.  The primary key of 
parent table is oid, so when I create parent table, there is no apparetly 
key word "primary key".  The problem jumps out.

When I create child table using columnn constraint on delete, the SQL says:

"PRIMARY KEY for referenced table "parent" not found"

I do not need to specify the primary key since I am using oid.  How can I 
get around this problem?

Thanks.

Zhidian Du



_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus




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

* Re: No promany key in parent table, how to use delete cascade?
@ 2002-11-08 06:49  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Zhidian Du <duzhidian@hotmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Stephan Szabo @ 2002-11-08 06:49 UTC (permalink / raw)
  To: Zhidian Du <duzhidian@hotmail.com>; +Cc: pgsql-sql

On Thu, 7 Nov 2002, Zhidian Du wrote:

> Dear All,
>
> I want to dreate a delete cascade in children tables.  The primary key of
> parent table is oid, so when I create parent table, there is no apparetly
> key word "primary key".  The problem jumps out.
>
> When I create child table using columnn constraint on delete, the SQL says:
>
> "PRIMARY KEY for referenced table "parent" not found"
>
> I do not need to specify the primary key since I am using oid.  How can I
> get around this problem?

I'm not sure if 7.2 lets you make the constraint at all, but even if it
does, you need a unique index on oid and you need to specify that the
constraint is to oid (col references parent(oid))




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


end of thread, other threads:[~2002-11-08 06:49 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-08 06:19 No promany key in parent table, how to use delete cascade? Zhidian Du <duzhidian@hotmail.com>
2002-11-08 06:49 ` Stephan Szabo <sszabo@megazone23.bigpanda.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