PRIMARY KEY not found?

Started by Vernon Smithover 22 years ago2 messagesgeneral
Jump to latest
#1Vernon Smith
vwu98034@lycos.com

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?

____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005

#2Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Vernon Smith (#1)
Re: PRIMARY KEY not found?

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)