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                                          [EMAIL PROTECTED]
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 


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to