Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top