> On 5 Jul 2022, at 1:02, Rhys A.D. Stewart <rhys.stew...@gmail.com> wrote:
> 
> Greetings All,
> 
> I have a trigger that is attached to several different tables. In the
> trigger function I retrieve a single row and I want the info from a
> specific column. This column is dependent on the table in question.
> and I have the column name stored in a variable as well. Without
> writing a conditional for each table, what is the best way to
> dynamically get the data from the record variable?

I would create a simple trigger function for each of those tables that just 
extracts the value(s) from the field(s) you mentioned, and then pass those 
values on to a generic function that does the actual table-independent work.

The usual trigger pseudo-columns and variables wouldn’t be available in that 
generic function, but considering that your triggers fire from different 
tables, you could either pass them on or they (probably) don’t make sense in 
the context of the generic function.

Alban Hertroys
--
There is always an exception to always.






Reply via email to