Re: Before image of selective columns.

From: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
To: Gambhir Singh <gambhir(dot)singh05(at)gmail(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Before image of selective columns.
Date: 2025-01-10 13:40:59
Message-ID: E5FB3E07-51B3-4B6F-B9EF-5D5114648206@elevated-dev.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> On Jan 10, 2025, at 2:55 AM, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
>
> That looks like a job for a trigger; perhaps a statement level trigger
> with a transition table.

Indeed.

I just want to add from experience: put the row values into a JSON column in the audit table. Otherwise, what do you do when the table definition changes? It's not just that you would have to keep the audit table schema in sync, it's possible to have a change which is not compatible with the old definition, such that you now really can't have one table that covers both old and new exactly, and then have to resort to renaming columns or some such...

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ron Johnson 2025-01-10 14:43:46 Re: Before image of selective columns.
Previous Message Laurenz Albe 2025-01-10 09:55:00 Re: Before image of selective columns.