Purely declarative FKs

From: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Purely declarative FKs
Date: 2023-10-16 07:51:44
Message-ID: 589ff648-9774-d166-450e-74695ae77161@gelassene-pferde.biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

Please bear with me, if this is the wrong place or this is an old
question answered over and over again.

Context: In my professional life I rarely come across
projects/applications where there are foreign keys on the database. This
is due to loading freedom not due to that there actually were no
relations. And usually, there is no datamodel. Only the database objects
have been implemented. So, they end up with a bunch/mess of tables, up
to your choice, and relations are insider information.

I have read the PostgreSQL documentation on Foreign keys. It seems, that
it is not possible (easily) to have inactive FKs, so one can have both.
The relation information on the database at least but the freedom of
load order/speed at the same time. My short research on the net spoke
about disabling the trigger used by the FK. If that is possible, this
would be a way but it feels underhanded to me and I would not have a
good feeling to do it.

Question: Are there plans to provide a feature in PostgreSQL that one
can have foreign keys for purely documentation purpose - I know, one
could use a modelling tool and just not implement the FKs, but my
reality is, there is hardly ever a modelling tool involved.

Kind regards

Thiemo

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2023-10-16 08:43:30 Re: Purely declarative FKs
Previous Message Victor Dobrovolsky 2023-10-15 21:54:22 Re: right way of using case-expressions in plpgsql functions