In my postgresql database I have an "on update" trigger on a table (call it table A) that audits record changes. I also have another update trigger on a second table (table B) that changes a value in table A. Naturally, the firing of the trigger on table B causes the trigger on table A to fire as well, as table A is updated.
To prevent this (since I only want to audit USER changes, not automatic changes), my trigger on table A currently ignores changes to the fields that are modified by the table B trigger. However, while this works, this approach doesn't sit well with me - what if a user modifies one of the fields that are also modified by the table B trigger? That change won't be logged (unless they also modify other fields that aren't ignored).
So my question is this: is there a "better way" to prevent the table A audit trigger from running in response to changes due to the table B trigger?