|From:||Oliver Elphick <olly(at)lfix(dot)co(dot)uk>|
|To:||Bruno Baguette <pgsql-ml(at)baguette(dot)net>|
|Subject:||Re: Primary key inheritance problem|
|Views:||Raw Message | Whole Thread | Download mbox|
On Fri, 2004-08-27 at 11:58, Bruno Baguette wrote:
> 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(at)lfix(dot)co(dot)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
|Next Message||Tom Lane||2004-08-29 16:45:34||Re: Migrating between versions. Problem with regexp|
|Previous Message||Stephan Szabo||2004-08-29 16:33:33||Re: Primary key inheritance problem|