Re: Table Inheritance and Foreign Keys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Riaan Stander" <rstander(at)exa(dot)co(dot)za>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Table Inheritance and Foreign Keys
Date: 2019-02-17 22:58:55
Message-ID: 8781.1550444335@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Riaan Stander" <rstander(at)exa(dot)co(dot)za> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2019-02-18 01:06:14 Re: Channel binding not supported using scram-sha-256 passwords
Previous Message Riaan Stander 2019-02-17 22:11:22 Table Inheritance and Foreign Keys