Inheritance referential integrity problem

Поиск
Список
Период
Сортировка
От Petru Paler
Тема Inheritance referential integrity problem
Дата
Msg-id Pine.LNX.4.44.0204021535230.20774-100000@rostock.criermedia.ro
обсуждение исходный текст
Ответы Re: Inheritance referential integrity problem  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
Hello everyone,


I'm using Postgresql's very nice inheritance support in a project, but I
just stumbled upon a problem that I'm not sure how to fix (or whether it's
my problem or postgresql's).

Here is a small set of tables that can be used to reproduce the problem:

create table a (id integer primary key);
create table b (foo varchar(100)) inherits(a);
create table c(id integer primary key, b_id integer references a(id));

The data:

test=# insert into b(id, foo) values (1, 'asd');
INSERT 19991 1
test=# select * from b;
 id | foo
----+-----
  1 | asd
(1 row)

test=# select * from a;
 id
----
  1
(1 row)


And the problem:

test=# insert into c (id, b_id) values (5, 1);
ERROR:  <unnamed> referential integrity violation - key referenced from c
not found in a

Could someone enlighten me on what I'm missing? Why is the constraint not
satisfied, since the key is clearly present in a? If that row is
considered to belong to b, then why does it show up in a?


If possible, please Cc me on the responses as I'm not subscribed to this
mailing list.


Thank you,
Petru


В списке pgsql-general по дате отправления:

Предыдущее
От: "Yuri A. Kabaenkov"
Дата:
Сообщение: changeing type of column
Следующее
От: Devrim GUNDUZ
Дата:
Сообщение: Re: changeing type of column