From: | Isaac Morland <isaac(dot)morland(at)gmail(dot)com> |
---|---|
To: | Ron Johnson <ronljohnsonjr(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Does trigger only accept functions? |
Date: | 2024-06-12 16:40:03 |
Message-ID: | CAMsGm5dqHQ_Sg5wgYg3mXJfOXPrGTK1s2cmNzEriNuAeQt=6NQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 11 Jun 2024 at 18:25, Ron Johnson <ronljohnsonjr(at)gmail(dot)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.).
From | Date | Subject | |
---|---|---|---|
Next Message | Justin | 2024-06-12 17:01:20 | Re: Questions on logical replication |
Previous Message | Casey & Gina | 2024-06-12 15:34:56 | Question about UNIX socket connections and SSL |