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

Re: REFERENCES fails on derived classes

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: mcaine(at)artlogic(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: REFERENCES fails on derived classes
Date: 2001-06-04 15:14:35
Message-ID: Pine.BSF.4.21.0106040813030.4530-100000@megazone23.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Sat, 2 Jun 2001, J. Michael Caine wrote:

> the following works:
> 
> create table t1 (id serial primary key);
> create table t2 (id serial primary key);
> create table t12 (
> 	t1_id int references t1(id) on delete cascade,
> 	t2_id int references t2(id) on delete cascade
> );
> 
> but the following does not:
> create table t1d () inherits(t1);
> create table t1d2 (
> 	t1d_id int references t1d(id) on delete cascade,
> 	t2_id int references t2(id) on delete cascade
> );
> 
> i'm told:
> ERROR: UNIQUE constraint matching given keys for referenced table t1d not
> found
> 
> i'm working in postgresql 7.1 (i686-pc-linux-gnu)
> 
> hope this is a bug (and i'm not wasting your time) and easily verifiable,

Sort of.  The unique constraint does not get inherited by t1d right now
(nor do fk constraints inherit) so there isn't a unique constraint on
t1d(id).  Add a unique constraint to t1d(id) and it should work.


In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2001-06-04 15:15:18
Subject: Re: Problem with sql
Previous:From: Tom LaneDate: 2001-06-04 15:11:45
Subject: Re: Bug?

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