Skip site navigation (1) Skip section navigation (2)

Primary key inheritance problem

From: Bruno Baguette <pgsql-ml(at)baguette(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Primary key inheritance problem
Date: 2004-08-27 10:58:50
Message-ID: 412F13EA.9070003@baguette.net (view raw or flat)
Thread:
Lists: pgsql-general
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.
Here's a little sample to show my problem :

CREATE TABLE foo_a
(
        pk_idmyfoo INT2 PRIMARY KEY NOT NULL,
        myfoo_name VARCHAR(10)
);

CREATE TABLE child_foo
(
        child_foo_nickname VARCHAR(20)
) INHERITS (foo_a);

CREATE TABLE childfoo_bookmarks
(
        fk_idchildfoo INT2 NOT NULL REFERENCES child_foo (pk_idmyfoo),
        url VARCHAR(250)
);

The error I get is :
ERROR:  there is no unique constraint matching given keys for referenced 
table "child_foo"

What can I do to solve that problem ?

Thanks in advance for your help !

--
Bruno Baguette - pgsql-ml(at)baguette(dot)net

Responses

pgsql-general by date

Next:From: David WheelerDate: 2004-08-27 11:54:29
Subject: Re: UTF-8 and LIKE vs =
Previous:From: Oliver ElphickDate: 2004-08-27 09:08:10
Subject: Re: Creating Functions in Separate Schema

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group