Re: Does trigger only accept functions? - Mailing list pgsql-general

From Isaac Morland
Subject Re: Does trigger only accept functions?
Date
Msg-id CAMsGm5dqHQ_Sg5wgYg3mXJfOXPrGTK1s2cmNzEriNuAeQt=6NQ@mail.gmail.com
Whole thread Raw
In response to Re: Does trigger only accept functions?  (Ron Johnson <ronljohnsonjr@gmail.com>)
List pgsql-general
On Tue, 11 Jun 2024 at 18:25, Ron Johnson <ronljohnsonjr@gmail.com> wrote:

Since all the functions are going to be similar, I'd write a shell script to generate all the triggers, one per relevant.  If you're going to record every field, then save effort, and don't bother enumerating them.  You'll need to dig into the PG catalog's guts to list columns in the correct order, but Google and Stack Exchange makes that easy enough.

I'd use a DO block and write a loop in PL/PGSQL. Then everything stays in Postgres and you have all the support of Postgres when writing your SQL-writing code (quote_ident, the reg* types, etc.).

pgsql-general by date:

Previous
From: Casey & Gina
Date:
Subject: Question about UNIX socket connections and SSL
Next
From: Justin
Date:
Subject: Re: Questions on logical replication