Re(2): REFERENCES fails on derived classes
| От | Michael Caine |
|---|---|
| Тема | Re(2): REFERENCES fails on derived classes |
| Дата | |
| Msg-id | fc.000f4b1100146d133b9aca00c10327eb.146d14@artlogic.com обсуждение исходный текст |
| Ответ на | Re: REFERENCES fails on derived classes (Stephan Szabo <sszabo@megazone23.bigpanda.com>) |
| Ответы |
Re: Re(2): REFERENCES fails on derived classes
|
| Список | pgsql-bugs |
a month i was told that my possible bug submission was "sort of" a bug. the report and reply are below. now i write a follow up because i don't know how to establish a workroom. specifically, i know know that a unique constraint must be added to an inherited "id" field, even if it's a primary key in the base table. i can do this by 'CREATE INDEX', but this creates a completely new constraint. i want to share the unique 'serial' behavior between the base table and derived table, so that en entry in either table is unique between the tables. that way, when i do a 'SELECT baseTable*' kind of command, i can differentiate between two records. is there a way to do this, or could this be considered a valid bug of some sort? thank you, jmichael sszabo@megazone23.bigpanda.com writes: >On Sat, 2 Jun 2001, J. Michael Caine wrote: > >> the following works: >> >> create table t1 (id serial primary key); >> create table t2 (id serial primary key); >> create table t12 ( >> t1_id int references t1(id) on delete cascade, >> t2_id int references t2(id) on delete cascade >> ); >> >> but the following does not: >> create table t1d () inherits(t1); >> create table t1d2 ( >> t1d_id int references t1d(id) on delete cascade, >> t2_id int references t2(id) on delete cascade >> ); >> >> i'm told: >> ERROR: UNIQUE constraint matching given keys for referenced table t1d >not >> found >> >> i'm working in postgresql 7.1 (i686-pc-linux-gnu) >> >> hope this is a bug (and i'm not wasting your time) and easily >verifiable, > >Sort of. The unique constraint does not get inherited by t1d right now >(nor do fk constraints inherit) so there isn't a unique constraint on >t1d(id). Add a unique constraint to t1d(id) and it should work. >
В списке pgsql-bugs по дате отправления: