Re: foreign keys on multiple parent table

From: Lorusso Domenico <domenico(dot)l76(at)gmail(dot)com>
To: Les <nagylzs(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: foreign keys on multiple parent table
Date: 2023-06-23 21:31:54
Message-ID: CAJMpnG4pr4qQipfBFoJOm4ypZ9-55YJeBLdYnL=4cgQTSWjsNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you Les for the link, it's a very good example, unfortunately my need
is more applicative (we need to store user of application, not the on pg,
proces who start etc), but for sure I can take advantage of it.

Il giorno mar 20 giu 2023 alle ore 23:01 Les <nagylzs(at)gmail(dot)com> ha scritto:

> .
>>
>
>
>> 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?
>>
>
> For existing solution, check out
> https://github.com/2ndQuadrant/audit-trigger
>
> Regarding fk constraints, a single fk constraint can only reference the
> primary key of a single table.
>
> But, if you want to be serious about audit logs, then you need to keep
> logs of deletions too, and for those, foreign key constraints would not
> work anyway.
>
> You may also want to consider bulk insert speed. Foreign key constraint
> checking can reduce speed.
>
> Laszlo
>
>
>
>
>
>
>>

--
Domenico L.

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lorusso Domenico 2023-06-23 23:08:24 Re: foreign keys on multiple parent table
Previous Message Anthony DeBarros 2023-06-23 15:13:49 Language Pack missing from StackBuilder (EDB Windows download)