From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Greg Hulands <ghulands(at)bigpond(dot)net(dot)au> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Foreign Key to Inherited table |
Date: | 2003-11-04 21:21:56 |
Message-ID: | 20031104132006.C67160@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 4 Nov 2003, Greg Hulands wrote:
> I have a table called Person that has a primary key personID. Another
> table called ProUser that inherits from Person. In another table called
> ProPriceSchedule I have a foreign key constraint to the ProUser table,
> like so: CONSTRAINT proUser FOREIGN KEY (personID) REFERENCES
> ProUser(personID).
>
> The problem I am having is this: ERROR: UNIQUE constraint matching
> given keys for referenced table "prouser" not found
That's because there isn't one. Primary keys, unique constraints and
foreign key constraints don't meaningfully inherit currently. So, for now
ProUser has no unique constraint on the personID field unless you define
one in ProUser (and said constraint does not prevent a personID in Person
from being duplicated in ProUser).
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-11-04 21:26:38 | Re: Using SUBSELECT in CHECK expressions |
Previous Message | Stephan Szabo | 2003-11-04 21:19:45 | Re: Using SUBSELECT in CHECK expressions |