Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 6D3161337C20 for ; Tue, 3 May 2011 19:42:54 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 08763-02-7 for ; Tue, 3 May 2011 22:42:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 3E7D71337DFE for ; Tue, 3 May 2011 19:12:53 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p43MCrki078203 for ; Tue, 3 May 2011 22:12:53 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p43MCrv0078202; Tue, 3 May 2011 22:12:53 GMT (envelope-from www) Date: Tue, 3 May 2011 22:12:53 GMT Message-Id: <201105032212.p43MCrv0078202@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6003: Cannot have a constraint foreign key on master class with inheritance From: "David carlos Manuelda" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201105/7 X-Sequence-Number: 30146 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?