Обсуждение: Get affected table name in trigger function?

Поиск
Список
Период
Сортировка

Get affected table name in trigger function?

От
Emi Lu
Дата:
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?

От
Tom Lane
Дата:
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