Trigger propagation in PostgreSQL inheritance

2019-08-30 22:36发布

问题:

I am working with postgreSOL. I have a parent table and child table, which inherits the parent table.I create a trigger for the parent table. Is this trigger is propagated to child table? Any possible techniques to inherit the trigger also is available?

回答1:

No, it isn't. You should write another trigger for the child table. Based on what your trigger should do, in same situations you can use the trigger on the parent table. For example, that trigger could decide in which table the data should go depending on some condition if an 'insert' query is made for the parent table.