Question regardding info available in customer C trigger function
Question regardding info available in customer C trigger function
От:
"Curtis H. Wilbar Jr." <curtis@hawkmountain.net>
Дата:
I've been scouring the docs, but have not come up with answers for all my questions. I found out how to deal with trigger function arguments via PG_GETARG_xxx. However, is there a way in my C function to determine the name of the table and of the database that caused the trigger. This trigger will be used in several tables in several databases, and while I could pass these names as parameters, it would be much easier to be able to determine this via the context when called. Any info would be greatly appreciated. -- Curt Curtis H. Wilbar Jr. Hawk Mountain Networks curtis@hawkmountain.net
Re: Question regardding info available in customer C trigger function
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Curtis H. Wilbar Jr." writes: > However, is there a way in my C function to determine the name of the > table and of the database that caused the trigger. The current database name is not passed around as a parameter, but you can get it from the global variable DatabaseName. As for the table name, try RelationGetRelationName(triggerdata->tg_relation). regards, tom lane