Re: Trigger Function question

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: DAVID ROTH <adaptron(at)comcast(dot)net>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Trigger Function question
Date: 2023-07-10 18:23:23
Message-ID: DF18ED9A-83D1-4CE8-888F-2BF3393CD9A3@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Jul 10, 2023, at 11:20, DAVID ROTH <adaptron(at)comcast(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message DAVID ROTH 2023-07-10 18:29:59 Re: Trigger Function question
Previous Message DAVID ROTH 2023-07-10 18:20:30 Trigger Function question