pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Zhidian Du <duzhidian@hotmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: No promany key in parent table, how to use delete cascade?
Date: Thu, 7 Nov 2002 22:49:34 -0800 (PST)
Message-ID: <20021107224708.K6692-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <F1364A2DreBBsQwY6YH00000812@hotmail.com>

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))




view thread (2+ messages)

Message-ID: <20021107224708.K6692-100000@megazone23.bigpanda.com>
Permalink:  ../20021107224708.K6692-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20021107224708.K6692-100000@megazone23.bigpanda.com

 · 

reply

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: sszabo@megazone23.bigpanda.com, duzhidian@hotmail.com
  Subject: Re: No promany key in parent table, how to use delete cascade?
  In-Reply-To: <20021107224708.K6692-100000@megazone23.bigpanda.com>

* 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