inheritance and primary key contraint

Поиск
Список
Период
Сортировка
От david.butcher@cathaynetworks.com
Тема inheritance and primary key contraint
Дата
Msg-id 1021837447.3ce800874e076@sinclair.swishmail.com
обсуждение исходный текст
Список pgsql-general
The primary key constraint does not seem to be enforced across inheritance.

Page 69 7.2 referennce manual
"unique contraints and primary keys are not inherited in the current
implementation. This makes the combination of unique constraints and inheritance
rather dysfunctional'.

In the following example, we are able to insert 2 rows with identical primary
keys - one on the base table and one on the derived table. Both examples exhibit
the same behavior.

What can we do to enforce uniqueness over the whole tree?

CREATE TABLE Base( baseId  integer, PRIMARY KEY ( baseId ) );
CREATE TABLE Derived () INHERITS (Base);
insert into Derived (baseId) values (1);
// this insert should fail, but does not
insert into Base (baseId) values (1);


CREATE TABLE Base( baseId  integer, PRIMARY KEY ( baseId ) );
CREATE TABLE Derived (PRIMARY KEY (baseId)) INHERITS (Base);
insert into Derived (baseId) values (1);
insert into Base (baseId) values (1);
// this insert should fail, but does not
insert into Base (baseId) values (1);



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

Предыдущее
От: Uros Gruber
Дата:
Сообщение: Re: LIMIT between some column
Следующее
От: "sheetal"
Дата:
Сообщение: Help..