Re: PRIMARY KEY not found?

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Vernon Smith <vwu98034(at)lycos(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: PRIMARY KEY not found?
Date: 2003-08-03 01:31:17
Message-ID: 20030802183024.E90895-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 2 Aug 2003, Vernon Smith wrote:

>
> Here is the problem:
>
> Table A ( id int, ...)
> Table B ( ... ) inherits (A)
>
> CREATE TABLE C ( id int REFERENCES B ON DELETE CASCADE, ...);
>
> ERROR: PRIMARY KEY for referenced table "B" not found
>
> It is fine when the reference is table A.
>
> Why?

I'm guessing that table A has a primary key on id?
Primary keys are not currently inherited, so you need to define
the key on B as well (and it doesn't guarantee uniqueness between
A and B)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2003-08-03 07:27:08 Re: Inheritance & multiple-value fields
Previous Message Vernon Smith 2003-08-03 00:06:11 PRIMARY KEY not found?