From: DAVID ROTH <adaptron@comcast.net>
To: Christophe Pettus <xof@thebuild.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Trigger Function question
Date: Mon, 10 Jul 2023 14:42:00 -0400 (EDT)
Message-ID: <1628697287.171908.1689014521034@connect.xfinity.com> (raw)
In-Reply-To: <870476B2-8403-46F4-BA0F-A03E226B07E3@thebuild.com>
References: <1875078143.170839.1689013230630@connect.xfinity.com>
<DF18ED9A-83D1-4CE8-888F-2BF3393CD9A3@thebuild.com>
<1715546791.171305.1689013799237@connect.xfinity.com>
<870476B2-8403-46F4-BA0F-A03E226B07E3@thebuild.com>
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@thebuild.com> wrote:
>
>
> > On Jul 10, 2023, at 11:29, DAVID ROTH <adaptron@comcast.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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adaptron@comcast.net, xof@thebuild.com
Subject: Re: Trigger Function question
In-Reply-To: <1628697287.171908.1689014521034@connect.xfinity.com>
References: <1875078143.170839.1689013230630@connect.xfinity.com> <DF18ED9A-83D1-4CE8-888F-2BF3393CD9A3@thebuild.com> <1715546791.171305.1689013799237@connect.xfinity.com> <870476B2-8403-46F4-BA0F-A03E226B07E3@thebuild.com> <1628697287.171908.1689014521034@connect.xfinity.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox