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

BUG #1688: inheritance and foreign key creation problem

From: "" <wrobell(at)pld-linux(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1688: inheritance and foreign key creation problem
Date: 2005-05-29 21:08:59
Message-ID: 20050529210859.0C533F0B06@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1688
Logged by:          
Email address:      wrobell(at)pld-linux(dot)org
PostgreSQL version: 8.0.3
Operating system:   Linux
Description:        inheritance and foreign key creation problem
Details: 

-----------
create table employee (
    __key__      integer,
    name         varchar(10) not null,
    surname      varchar(20) not null,
    phone        varchar(12) not null,
    unique (name, surname),
    primary key (__key__)
);

create table boss (
    dep_fkey     integer unique
) inherits(employee);


create table department (
    __key__        integer,
    boss_fkey  integer unique,
    primary key (__key__),
    foreign key (boss_fkey) references boss(__key__) initially deferred
);

-----------

We can see that boss relation has __key__ column (inherited from employee
relation), but when executing above script PostgreSQL fails with message:

psql:script.sql:20: ERROR:  there is no unique constraint matching given
keys for referenced table "boss"

Responses

pgsql-bugs by date

Next:From: wrobellDate: 2005-05-29 21:14:39
Subject: BUG #1689: problem with inheritance and foreign keys
Previous:From: Halley Pacheco de OliveiraDate: 2005-05-29 18:18:35
Subject: BUG #1687: Regular expression problem (II)

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