public inbox for [email protected]  
help / color / mirror / Atom feed
From: Isaac Morland <[email protected]>
To: Ron Johnson <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Does trigger only accept functions?
Date: Wed, 12 Jun 2024 12:40:03 -0400
Message-ID: <CAMsGm5dqHQ_Sg5wgYg3mXJfOXPrGTK1s2cmNzEriNuAeQt=6NQ@mail.gmail.com> (raw)
In-Reply-To: <CANzqJaDrByG6Pbi70tK2j_8KP1P6TvF5XoAhSLDVMpCwNhFn4A@mail.gmail.com>
References: <CAB+=1TWT1_kKdBtuWvLBKJ1hkjxsaRZfMQADQU7bsVtat9q-LA@mail.gmail.com>
	<[email protected]>
	<CAB+=1TUWFJ_9BsqVZkj+3V18WxpAZojzhbOLN1kGzUYqx=TLfQ@mail.gmail.com>
	<CANzqJaDrByG6Pbi70tK2j_8KP1P6TvF5XoAhSLDVMpCwNhFn4A@mail.gmail.com>

On Tue, 11 Jun 2024 at 18:25, Ron Johnson <[email protected]> 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.).


view thread (2+ messages)

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Does trigger only accept functions?
  In-Reply-To: <CAMsGm5dqHQ_Sg5wgYg3mXJfOXPrGTK1s2cmNzEriNuAeQt=6NQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox