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
Sent via pgsql-hackers mailing list (firstname.lastname@example.org)
To make changes to your subscription: