Re: Inheritance

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Jan Johansson <jan(dot)johansson(dot)mr(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inheritance
Date: 2016-05-23 21:49:52
Message-ID: 04346fe7-59ea-0d0e-52ef-4c13936bf215@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-05-23 21:53:37 Re: Re: [BUGS] BUG #14153: Unrecognized node type error when upsert is present in recursive CTE
Previous Message David G. Johnston 2016-05-23 21:45:08 Re: Calling json_* functions with JSONB data