From: | DAVID ROTH <adaptron(at)comcast(dot)net> |
---|---|
To: | Christophe Pettus <xof(at)thebuild(dot)com> |
Cc: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Trigger Function question |
Date: | 2023-07-10 18:42:00 |
Message-ID: | 1628697287.171908.1689014521034@connect.xfinity.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I was hoping that NEW could be treated as a record or as an arrayy similar to pg_argv.
> On 07/10/2023 2:31 PM EDT Christophe Pettus <xof(at)thebuild(dot)com> wrote:
>
>
> > On Jul 10, 2023, at 11:29, DAVID ROTH <adaptron(at)comcast(dot)net> wrote:
> >
> > I want to use a single trigger function to log multiple tables and the tables have different columns. I can get the names of the columns from the catalog. But I have not been able to figure out how to get NEW.x when x is not known until run time.
>
> Unless you only want to log a subset of rows from each table, it's not required that you get the specific columns. Here's an example of how to do a generic auditing trigger:
>
> https://wiki.postgresql.org/wiki/Audit_trigger
>
> If it's supported on your platform, you might also look at the pg_audit extension.
From | Date | Subject | |
---|---|---|---|
Next Message | DAVID ROTH | 2023-07-10 18:46:01 | Re: Trigger Function question |
Previous Message | Christophe Pettus | 2023-07-10 18:38:37 | Re: Trigger Function question |