Re: Inheritance in PostgreSQL - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Inheritance in PostgreSQL
Date
Msg-id CAHyXU0y85n2ZzCPzZbxLk+WDeUjQXzoi=f1TumoYpPqKTWJVAw@mail.gmail.com
Whole thread Raw
In response to RE: Inheritance in PostgreSQL  (Jeff Laing <Jeff.Laing@synchronoss.com>)
Responses Re: Inheritance in PostgreSQL  (Thomas Kellerer <shammat@gmx.net>)
List pgsql-general
On Tue, Oct 17, 2023 at 5:36 PM Jeff Laing <Jeff.Laing@synchronoss.com> wrote:

“Don’t use table inheritance” IS on that page


Yeah, inheritance probably would have been removed a long time ago except that it was underneath the partitioning feature.  The basic idea of implementing polymorphic record storage essentially hacks SQL in a way it doesn't want to be hacks, thus the feature never really worked properly.  If you want variant storage, use hstore, json, etc. or use the various techniques that split the entity across multiple tables. 

The only thing you can't really do in SQL easily without writing nasty triggers are things like, 'this table must be linked from one and only one of these candidate tables'.  I think the language probably ought to support this, but I don't think postgres would unless the standard did.  I try to avoid handwriting RI when possible in triggers, but in this case it's the only approach that works within language constraints and can formally validate the model.

merlin

pgsql-general by date:

Previous
From: Paul Jungwirth
Date:
Subject: Re: Need efficient way to remove (almost) duplicate rows from a table
Next
From: Michael Nolan
Date:
Subject: Fwd: Need efficient way to remove (almost) duplicate rows from a table