By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,512 Members | 644 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,512 IT Pros & Developers. It's quick & easy.

FK to inherited table, referential integrity violation

P: n/a
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
Share this Question
Share on Google+
1 Reply

P: n/a
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.