Thread: Get affected table name in trigger function?

Get affected table name in trigger function?

From
Emi Lu
Date:
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


Re: Get affected table name in trigger function?

From
Tom Lane
Date:
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