在PostgreSQL继承中触发传播

在PostgreSQL继承中触发传播

本文介绍了在PostgreSQL继承中触发传播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与postgreSOL合作。我有一个父表和一个子表,它们继承了父表。我为父表创建了一个触发器。该触发器是否传播到子表?

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?

推荐答案

不,不是吗?您应该为子表编写另一个触发器。根据触发器应该执行的操作,在相同情况下,可以在父表上使用触发器。例如,如果对父表进行了插入查询,则该触发器可以根据某种条件决定数据应该进入哪个表。

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.

这篇关于在PostgreSQL继承中触发传播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 12:22