Re: Inheritance in PostgreSQL

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Jeff Laing <Jeff(dot)Laing(at)synchronoss(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, Luis Bruno <l(dot)brunofidelis(at)gmail(dot)com>
Subject: Re: Inheritance in PostgreSQL
Date: 2023-10-18 01:20:04
Message-ID: CAHyXU0y85n2ZzCPzZbxLk+WDeUjQXzoi=f1TumoYpPqKTWJVAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 17, 2023 at 5:36 PM Jeff Laing <Jeff(dot)Laing(at)synchronoss(dot)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

>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Nolan 2023-10-18 01:52:01 Fwd: Need efficient way to remove (almost) duplicate rows from a table
Previous Message Paul Jungwirth 2023-10-17 23:09:17 Re: Need efficient way to remove (almost) duplicate rows from a table