Re: Primary key inheritance problem

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: Primary key inheritance problem
Дата
Msg-id 1093797247.29613.347.camel@linda
обсуждение исходный текст
Ответ на Primary key inheritance problem  (Bruno Baguette <pgsql-ml@baguette.net>)
Ответы Re: Primary key inheritance problem  ("Matthew M Davis" <mmd@teledavis.com>)
Список pgsql-general
On Fri, 2004-08-27 at 11:58, Bruno Baguette wrote:
> Hello,
>
> I've a strange problem with inheritance on PostgreSQL 7.4.1. It seems
> like tables don't inherits the primary key of the 'mother' table.
...
> The error I get is :
> ERROR:  there is no unique constraint matching given keys for referenced
> table "child_foo"

Primary and foreign key constraints are not inherited.  This is a defect
in the current system.

> What can I do to solve that problem ?

Create an index table to provide a unique key for the whole hierarchy.
Each member of the hierarchy has a foreign key reference to it na has
its own primary key on the referencing field.  Use triggers to update
the index table.

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "Preach the word; be instant in season, out of season;
      reprove, rebuke, exhort with all longsuffering and
      doctrine."          II Timothy 4:2


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Primary key inheritance problem
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Migrating between versions. Problem with regexp