문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top