pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christophe Pettus <xof@thebuild.com>
To: DAVID ROTH <adaptron@comcast.net>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Trigger Function question
Date: Mon, 10 Jul 2023 11:23:23 -0700
Message-ID: <DF18ED9A-83D1-4CE8-888F-2BF3393CD9A3@thebuild.com> (raw)
In-Reply-To: <1875078143.170839.1689013230630@connect.xfinity.com>
References: <1875078143.170839.1689013230630@connect.xfinity.com>



> On Jul 10, 2023, at 11:20, DAVID ROTH <adaptron@comcast.net> wrote:
> 
> In a trigger function, is there a way to get a list of all of the columns in the triggering table?

You can get the table that the trigger fired on with TG_TABLE_SCHEMA and TG_TABLE_NAME, and then query the system catalogs to get a list of columns.

But can you tell us a bit more about your use-case?  You may be able to write the trigger in such a way that it doesn't need to change behavior based on the columns.




view thread (12+ messages)  latest in thread

Message-ID: <DF18ED9A-83D1-4CE8-888F-2BF3393CD9A3@thebuild.com>
Permalink:  ../DF18ED9A-83D1-4CE8-888F-2BF3393CD9A3@thebuild.com/
Also on:    postgresql.org/message-id/DF18ED9A-83D1-4CE8-888F-2BF3393CD9A3@thebuild.com

 · 

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 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: xof@thebuild.com, adaptron@comcast.net
  Subject: Re: Trigger Function question
  In-Reply-To: <DF18ED9A-83D1-4CE8-888F-2BF3393CD9A3@thebuild.com>
  References: <1875078143.170839.1689013230630@connect.xfinity.com> <DF18ED9A-83D1-4CE8-888F-2BF3393CD9A3@thebuild.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