Table Inheritance and foreign key problem.
От | Kostas Maistrelis |
---|---|
Тема | Table Inheritance and foreign key problem. |
Дата | |
Msg-id | 377c89a20607230459l79271c5fnc25e09dc9d62ab36@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Table Inheritance and foreign key problem.
Re: Table Inheritance and foreign key problem. |
Список | pgsql-general |
I make 3 tables with this senario: b (id) extends a (id) and c (id) references a (id) i insert one record to table b (id = 1) and then i try to insert a record in table C (id = 1) but it is not possible, i get error (look at the sql statements above) NOTE if the C (id) references the b (id) the insert in table C is possible. I try this to postgresql 8.1.2 and 8.1.4 above is the exact SQL STATMENTS: ============================================ DROP TABLE a; DROP TABLE b; DROP TABLE c; CREATE TABLE a (id integer primary key); CREATE TABLE b (id integer primary key) INHERITS (a); CREATE TABLE c (id integer primary key references a(id)); insert into b values (1); SELECT * from b; id ---- 1 (1 row) SELECT * from a; id ---- 1 (1 row) INSERT INTO c VALUES (1); ERROR: insert or update on table "c" violates foreign key constraint "c_id_fkey" DETAIL: Key (id)=(1) is not present in table "a". ============================================ Thanks Kostas Maistrelis.
В списке pgsql-general по дате отправления: