Re: Inheritance - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: Inheritance
Date
Msg-id 04346fe7-59ea-0d0e-52ef-4c13936bf215@BlueTreble.com
Whole thread Raw
In response to Re: Inheritance  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: Inheritance  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 5/23/16 11:05 AM, Merlin Moncure wrote:
> Postgres doesn't work that way, and the documentation disclaims this:
> "Note: Although inheritance is frequently useful, it has not been
> integrated with unique constraints or foreign keys, which limits its
> usefulness. See Section 5.8 for more detail."
>
> Personally, I don't think this will ever be fixed.  The reason why it
> doesn't work is due to some foundational implementation decisions that
> would have to be revisited.

If the complaint is really about FKs/UNIQUE (and really AFAIK it's only 
UNIQUE that's the problem), then I agree: it should be addressed. It's a 
major impediment to partitioning (and generic inheritance).

> This feature was very much a product of the time, at the height of the
> "Object Relational" fad.  The trend for postgres has been in the exact
> opposite direction, towards the SQL standard.  Further complicating
> matters, inheritance has been repurposed to be the foundation for
> table partitioning, making heavy changes problematic.

I don't see why partitioning complicates fixing these issues. ISTM it's 
the exact same complaint for both inheritance and partitioning.

I also disagree about PK:PK FK's between a bunch of completely 
independent tables being a good way to model this stuff. It doubles the 
complexity of every query against a child table and doesn't perform 
nearly as well, because your data locality goes down the tubes.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)   mobile: 512-569-9461



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: [BUGS] BUG #14153: Unrecognized node type error when upsert is present in recursive CTE
Next
From: Joe Conway
Date:
Subject: Re: Changed SRF in targetlist handling