Get affected table name in trigger function?

Started by Emi Luabout 20 years ago2 messagesgeneral
Jump to latest
#1Emi Lu
emilu@encs.concordia.ca

Hello,

Is it possible to get current table name such as (TG_TABLENAME?) in a
trigger function?

For example, tables t1, t2, t3 all depend on one trigger function. In
the trigger function, is it possible to get the current affected table
name - is it t1, t2 or t3 ?

Thanks a lot,
Emi

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Emi Lu (#1)
Re: Get affected table name in trigger function?

Emi Lu <emilu@encs.concordia.ca> writes:

Is it possible to get current table name such as (TG_TABLENAME?) in a
trigger function?

TG_RELNAME ... or look it up from the table OID TG_RELID ... or pass it
in as a trigger parameter ...

regards, tom lane