Re: Exporting modifications to a table as XML/JSON

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Ertan Küçükoğlu <ertan(dot)kucukoglu(at)1nar(dot)com(dot)tr>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Exporting modifications to a table as XML/JSON
Date: 2020-05-11 23:51:06
Message-ID: CAKFQuwYu1rjB2TTLnCRY7c2vo+B_Hj2V1QOfqmygZtCyak4CCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, May 11, 2020 at 4:37 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> I am sure that examples exist in the wild of attaching an audit trigger to
> a table so that the json form of the OLD and NEW (the PostgreSQL version of
> "Inserted" and "Deleted" (more or less?) records can be either directly
> inserted into another table or passed to a function that handles that task
> (simple functional encapsulation).
>

In particular you should review the documentation:

https://www.postgresql.org/docs/12/plpgsql-trigger.html#PLPGSQL-DML-TRIGGER

Both the "record" oriented one and the newer "transition tables" one -
which is probably more similar to what your example code does (haven't used
that feature myself).

David J.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Igor Shmukler 2020-05-20 14:39:34 Postgres stored procedure errs while parsing JSONB object
Previous Message David G. Johnston 2020-05-11 23:37:29 Re: Exporting modifications to a table as XML/JSON