Re: PRIMARY KEY and INHERITANCE

Поиск
Список
Период
Сортировка
От Horst Herb
Тема Re: PRIMARY KEY and INHERITANCE
Дата
Msg-id 01010110095208.08574@munin.midgard
обсуждение исходный текст
Ответ на PRIMARY KEY and INHERITANCE  (Ferruccio Zamuner <nonsolosoft@diff.org>)
Ответы Re: PRIMARY KEY and INHERITANCE  (Ferruccio Zamuner <nonsolosoft@diff.org>)
Список pgsql-hackers
On Monday 01 January 2001 01:42, Ferruccio Zamuner wrote:
> Hi,
>
> some months ago I've asked for a suggestion for this bug:
>
> create table a (
>        id serial primary key,
>        something text
> );
>
> create table b (
>        morething text
> ) inherits (a);
>
> create table c (
>        trouble int references b;
> );
> NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
> check(s) ERROR:  PRIMARY KEY for referenced table "b" not found
>
>
> How is possible to resolve this bug?
> How is possible to talk about a ORDBMS with this kind of error?

It is not a bug, I would call it a missing feature. I had the same problem, 
and somebody from this list helped me with a private email. I think this 
should be included in the FAQ and general documentation.

What happens is that the attribute "id" is inherited, but the index on "id" 
is not. The workaround is:

create unique index table_b_id on b(id);

Then the index exists, and the foreign key can be referenced.

Yes, I share your believe that the automatic generation of this index should 
be a minimum requirement for an _O_RDBMS, but who will have time to implement 
it properly?

Regards,
Horst


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

Предыдущее
От: "Oliver Elphick"
Дата:
Сообщение: Re: PRIMARY KEY and INHERITANCE
Следующее
От: Larry Rosenman
Дата:
Сообщение: pg_dumpall (7.1beta1, current CVS)