From: | "Darrin Ladd" <darrin_ladd(at)hotmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Foreign key to all inherited tables |
Date: | 2000-08-22 14:26:43 |
Message-ID: | F57M7VHTUC0dHgQBGCY00007b18@hotmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I was wondering if there is a way to have a foreign key reference to the
primary key column of all tables throughout an inheritance tree. For
example, I have a parent_table with a unique_id (type serial) and a child
table which inherits the parent_table (inheriting the unique_id). I would
like to have another table have a field, unique_id, who's value must be in
the unique_id field of the parent or the child. I tried adding an asterix
to the end of the foreign key table refrence, {CONSTRAINT fk_other_table
FOREIGN KEY (unique_id) REFERENCES parent_table* (unique_id)} but the parser
didn't like that. Then I tried creating a check constraint on the field in
the 'other_table' to check if the value was 'IN (SELECT unique_id from
parent_table*)'. The table creation went fine, but when I tried to insert
any values into the table it produced an error:
ExecEvalExpr: unknown expression type 108.
Does anyone have a work-around for this?
Thanks!
Darrin
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
From | Date | Subject | |
---|---|---|---|
Next Message | Ned Lilly | 2000-08-22 15:43:20 | Great Bridge re-runs benchmark with MySQL "tuned" |
Previous Message | Greg Maxwell | 2000-08-22 14:01:30 | Stupid database use the index! |