foreign keys on multiple parent table

From: Lorusso Domenico <domenico(dot)l76(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: foreign keys on multiple parent table
Date: 2023-06-20 20:46:56
Message-ID: CAJMpnG72qkzsg=OAULTrCqU20uY7ZU885aZCLUyL-35_1LJzwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello guys,
I've many tables representing as many concepts.

For each record of each table I need to store extra information (think to
audit information, but more complex than a simple text)

The relation is 1:N, for each record there could be many audit records.

From programming point of view and also to reduce the number of objects in
DB could be convinient create just an audit table with a structure like:

- auditi id
- reference_uuid (the key of the main table)
- table_name
- list of audit data

Could work, but is there a way to set a reference key over the uuid of all
the tables?

--
Domenico L.

per stupire mezz'ora basta un libro di storia,
io cercai di imparare la Treccani a memoria... [F.d.A.]

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2023-06-20 20:50:48 Re: foreign keys on multiple parent table
Previous Message Marc Millas 2023-06-20 20:34:48 Re: pb with join plan