Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sHR4U-007RDu-Sa for pgsql-general@arkaria.postgresql.org; Wed, 12 Jun 2024 16:43:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sHR4T-002ipK-FZ for pgsql-general@arkaria.postgresql.org; Wed, 12 Jun 2024 16:43:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sHR1J-002cOT-By for pgsql-general@lists.postgresql.org; Wed, 12 Jun 2024 16:40:22 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sHR1H-000z2V-CN for pgsql-general@postgresql.org; Wed, 12 Jun 2024 16:40:20 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1f6b0a40721so623845ad.2 for ; Wed, 12 Jun 2024 09:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718210418; x=1718815218; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=OD3MvuBvknkpxWTd7DVXP04pdEoMbWzaeGUnEb+6EvM=; b=dQMd5uqB7CVahDbphVFV04BjKGwETlbPkvdE5eB6AJ6kSWgfY8vLMijxIPV5TnPSsJ HRbLg+xPJD/RC0DOTcFpxVcK+/0Pfb/h7XJI9tPwOfjPKbv81UaQIeWfFLv3wOgJgpg1 WyOZCz5q1E5hrCJlh+pwxw59ZiAaJeHeqxcoMPwXtYLvU86fvdp1EIx5LjVmBIT8N7Q5 fk/xdWVT3dm02WYHGR4doGmhZOG8LfVj/8hsjhOdXc75ktltJbbtzsdK0xfm2wFKmdgs Opm88BcvyJjCK8HEuW9rO9MTgwH3iD+SNNWMCuJjtAcGEYXeLveaBBkZE+KexQUZuC8o zS9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718210418; x=1718815218; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OD3MvuBvknkpxWTd7DVXP04pdEoMbWzaeGUnEb+6EvM=; b=Tdwtc7sARgAy6d05rS4uM+6t7n6XlPUWBYpBR84vTpaLkVSl4OlgB53FyD4BDsrhau iyfOGLHQPihDdWXBAqea/zi6v+weu+8c9N5zFrPXc8s4OC5nLz0uBWuQr5rP7xDLrHdq ajha8DWO8t6D86bGVwShA+kiUJ0hGyFZnG3IFjQAF2ogKrR/4kN8SjjoJh1jhekk2jtS emhHgK8RzVzHiYfeUc9HfAqsiQ5tL2i5qI/O0/Srr8oeeFqiph7lD5TG1x7dRMM7CNJR 8J4PH32OZ/aRqoUf6VZ5+F6vixnbUIAsZJmS6YflaFv4zP6Teo+ot74oHCvmpso/FnCy zL0g== X-Gm-Message-State: AOJu0YwqstvNBxM6Oil0Y5f/MNX1rdA0coIfdZ33983wS/Eqeux4HcuX wO+e+TGQEufrsohfXIdMp1gs3dPpHUjbq/+bi9ysKxO7xXHLtXcO5kCKESv0RgeFX5z+IoR8Xdc dSPEcyAPJxN3UYpKs4R3XXsorM8g= X-Google-Smtp-Source: AGHT+IECda5n/X8TGOLZZ3zxDQC+qqxYw9qrLx+pq37J2VYHZ03xXAc0UkLEm6JTXFMGLsnSagVL4YpSRkadbyoc8dU= X-Received: by 2002:a17:902:e84f:b0:1f6:fbde:9b96 with SMTP id d9443c01a7336-1f83b721fa2mr27012505ad.59.1718210418365; Wed, 12 Jun 2024 09:40:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Isaac Morland Date: Wed, 12 Jun 2024 12:40:03 -0400 Message-ID: Subject: Re: Does trigger only accept functions? To: Ron Johnson Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000a2e093061ab409c0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a2e093061ab409c0 Content-Type: text/plain; charset="UTF-8" On Tue, 11 Jun 2024 at 18:25, Ron Johnson 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.). --000000000000a2e093061ab409c0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 gene= rate all the triggers,=C2=A0one per relevant.=C2=A0 If you're going to = record every field, then save effort, and don't bother enumerating them= .=C2=A0 You'll need to dig into the PG catalog's guts to list colum= ns in the correct order, but Google and Stack Exchange makes that easy enou= gh.

I'd use a DO bloc= k and write a loop in PL/PGSQL. Then everything stays in Postgres and you h= ave all the support of Postgres when writing your SQL-writing code (quote_i= dent, the reg* types, etc.).
--000000000000a2e093061ab409c0--