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

Re: BUG #1688: inheritance and foreign key creation problem

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: wrobell(at)pld-linux(dot)org
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1688: inheritance and foreign key creation problem
Date: 2005-05-31 15:31:57
Message-ID: 20050531082856.M1879@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Sun, 29 May 2005,  wrote:

>
> 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
> );

Unique constraints do not currently inherit, so right now, there is no
unique constraint on boss.__key__ and you'll be able to insert duplicates.
Right now, you can almost work around this by explicitly placing a unique
constraint on the column, however, that only guarantees uniqueness within
a table not between employee and boss.


In response to

pgsql-bugs by date

Next:From: Stephan SzaboDate: 2005-05-31 15:34:26
Subject: Re: BUG #1689: problem with inheritance and foreign keys
Previous:From: Alvaro HerreraDate: 2005-05-31 15:15:23
Subject: Re: BUG #1686: Regular expression problem

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