From: David carlos Manuelda <stormbyte@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6003: Cannot have a constraint foreign key on master class with inheritance
Date: Tue, 3 May 2011 22:12:53 GMT
Message-ID: <201105032212.p43MCrv0078202@wwwmaster.postgresql.org> (raw)
The following bug has been logged online:
Bug reference: 6003
Logged by: David carlos Manuelda
Email address: stormbyte@gmail.com
PostgreSQL version: 9.0.3
Operating system: Gentoo Linux
Description: Cannot have a constraint foreign key on master class
with inheritance
Details:
I've reading on the internet and TODO, that there is a similar issue, but I
don't think it is the same.
Besides inheriting constraints of KEYS, it MUST have the hability to FOREIGN
KEY from another external (from inheritance view) table to master
inheritance table.
Without this, inheritance is MUCH limited and hacky.
Proposed:
CREATE TABLE foo (
id INTEGER NOT NULL,
...,
PRIMARY KEY (id)
);
CREATE TABLE bar (
otherdata VARCHAR(30) NOT NULL,
...,
) INHERITS (foo);
CREATE TABLE problematic_table (
id SERIAL NOT NULL,
....,
other_id INTEGER NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY other_id REFERENCES foo(id)
);
-- INSERTING DATA
INSERT INTO bar(id,otherdata) VALUES (5,'TEST'); -- OK!
INSERT INTO problematic_table(id,other_id) VALUES (1,5); -- WILL FAIL SINCE
IT WILL NOT FIND VALUE 5 FROM foo, BUT foo HAS ALREADY THAT VALUE STORED
I mean, without this, inheritance is pretty useless, and, in my opinion, it
is one of the greatest features of Postgre!
Is it a duplicate of what is in TODO and I understood it bad, or is this a
new issue?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: stormbyte@gmail.com
Subject: Re: BUG #6003: Cannot have a constraint foreign key on master class with inheritance
In-Reply-To: <201105032212.p43MCrv0078202@wwwmaster.postgresql.org>
References: <201105032212.p43MCrv0078202@wwwmaster.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox