Question

I have two tables, t1(foo) and t2(bar), and a trigger on update t2.bar that updates t1.foo to something else.

At first I thought of just prohibiting any updates on t1 by using a trigger before update on t1.foo that always throws an exception. However, wouldn't that also block changes from the first trigger?

How do I do this?

Was it helpful?

Solution

Use a "daemon" role (a non-login role for this dedicated purpose) that owns the trigger function in combination with SECURITY DEFINER And grant the necessary privileges on t1 to it.

Details in these related questions:
Is there a way to disable updates/deletes but still allow triggers to perform them?
Allow insertion only from within a trigger

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top