470,614 Members | 1,396 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

FK to inherited table, referential integrity violation

Is it bug?

CREATE TABLE base ( base INT PRIMARY KEY );
CREATE TABLE child ( val INT ) INHERITS ( base );
CREATE TABLE ref (
atr INT
, base INT REFERENCES base ON UPDATE cascade ON DELETE cascade );

INSERT INTO child VALUES ( 1, 2 );

SELECT * FROM base;
base
------
1

SELECT * FROM child;
base | val
------+-----
1 | 2

INSERT INTO ref VALUES ( 3, 1 );

ERROR: $1 referential integrity violation - key referenced from ref not
found in base

--
oo don't worry
\__/ be happy

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 11 '05 #1
1 1807
On Wed, 20 Aug 2003 ya***@seznam.cz wrote:
Is it bug?


Just an unimplemented feature. Foreign keys currently reference only
the named table and not any of the subtables. Inheritance has some
serious limitations right now (for example, the primary key on base
doesn't inherit to child as well which means you can insert multiple
rows with the same key into child). If you want the gory details, this
comes up every few months so there are lots of discussions in the
archives.
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tom Gazzini | last post: by
36 posts views Thread by toedipper | last post: by
4 posts views Thread by maricel | last post: by
4 posts views Thread by bobh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.