Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvVOz-0008Dc-TN for pgsql-general@arkaria.postgresql.org; Sun, 17 Feb 2019 22:59:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gvVOy-0006Vi-AT for pgsql-general@arkaria.postgresql.org; Sun, 17 Feb 2019 22:59:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvVOy-0006VV-27 for pgsql-general@lists.postgresql.org; Sun, 17 Feb 2019 22:59:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvVOw-0007JE-2R for pgsql-general@postgresql.org; Sun, 17 Feb 2019 22:59:11 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x1HMwtnF008782; Sun, 17 Feb 2019 17:58:55 -0500 From: Tom Lane To: "Riaan Stander" cc: pgsql-general@postgresql.org Subject: Re: Table Inheritance and Foreign Keys In-reply-to: <003501d4c70d$b7a8c3e0$26fa4ba0$@exa.co.za> References: <003501d4c70d$b7a8c3e0$26fa4ba0$@exa.co.za> Comments: In-reply-to "Riaan Stander" message dated "Mon, 18 Feb 2019 00:11:22 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8780.1550444335.1@sss.pgh.pa.us> Date: Sun, 17 Feb 2019 17:58:55 -0500 Message-ID: <8781.1550444335@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Riaan Stander" writes: > I've got a scenario where I'm building a table structure that allows for > building a tree. In order to properly separate the different column > requirements I've looked at using table inheritance. > [ but can't point a foreign key at an inheritance tree ] > My question is if anybody knows more as to if and when this actually will be > allowed/solved. Don't hold your breath :-(. It's been like that for decades. We do, as of v11, support foreign keys referencing partitioned tables, but that relies on the ability to declare a unique constraint across a partitioned table, which in turn relies on there being a known partitioning key (which has to be part of the unique column set). Generic inheritance doesn't have that much semantic knowledge about how the data is divvied up, so it's not really practical to support these things in a generic inheritance tree. Probably we should revise that bit of documentation to point people at the partitioning features; I doubt anything's ever going to be done about this for generic inheritance. regards, tom lane