Re: No promany key in parent table, how to use delete cascade?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Zhidian Du <duzhidian(at)hotmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: No promany key in parent table, how to use delete cascade?
Date: 2002-11-08 06:49:34
Message-ID: 20021107224708.K6692-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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))

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rachel.Vaudron 2002-11-08 07:22:55 Alter table
Previous Message Zhidian Du 2002-11-08 06:19:09 No promany key in parent table, how to use delete cascade?