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
"Curtis H. Wilbar Jr." <curtis@hawkmountain.net> 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
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера