当前位置:网站首页>Gbase 8C trigger (II)
Gbase 8C trigger (II)
2022-07-03 02:22:00 【Dazhuang twelve】
The statement that locates the parent table in the inheritance or partition hierarchy will not cause the statement level trigger of the affected child table to be triggered ; Only the statement level trigger of the parent table is triggered . however , Row level triggers for any affected child tables will be triggered .
If one INSERT contain ON CONFLICT DO UPDATE Clause and references EXCLUDED Column , Possible row level BEFORE INSERT Triggers and row level BEFORE UPDATE The effect of the trigger may be in a way that The final state of the updated row is applied transparently . however , For the row level of the two sets to be executed BEFORE Triggers don't need to have EXCLUDED Column references . When there are row levels at the same time BEFORE INSERT and BEFORE UPDATE Trigger modification is inserted / When updating rows ( Even if the modification has more or less the same effect , But if they are not idempotent , There may be a problem with this ), Possible unexpected results should be considered . Note that ON CONFLICT DO UPDATE when , Whether there is a quilt or not UPDATE influence ( And whether or not other UPDATE route ), Sentence level UPDATE Will be executed . With a ON CONFLICT DO UPDATE Clause INSERT Statement level... Will be executed first BEFOREINSERT, Then execute statement level BEFOREUPDATE trigger , Then there is the statement level AFTERUPDATE trigger , Finally, the statement level AFTERINSERT trigger .
Trigger functions called by statement level triggers should always return NULL. According to the selection of row level trigger , The trigger function called by it can return a table row ( type HeapTuple A value of ) Give the actuator . Row level triggers triggered before an operation have the following options :
- It can return to NULL To skip the operation on the current line . This instructs the actuator not to perform row level operations that invoke triggers ( Insertion of a specific table row 、 Modify or delete ).
- Row level only INSERT and UPDATE The trigger says , The returned row is called the row to be inserted or replaces the row to be updated . This allows the trigger function to modify the row to be inserted or updated .
A row level that unintentionally leads to any of these behaviors BEFORE The trigger must be careful about its result , Make it the same as the incoming line ( namely ,INSERT and UPDATE Trigger NEW That's ok ,DELETE Trigger OLD That's ok ).
A row level INSTEAD OF Triggers can return NULL To indicate that it has not modified any data from the underlying base table of the view , You can also return the passed in view row (INSERT and UPDATE Operation of the NEW That's ok , perhaps DELETE Operation of the OLD That's ok ). A non empty return value is used to mark that the trigger has performed the necessary data modification in the view . This will cause the count of lines modified by the command to be increased . about INSERT and UPDATE operation , The trigger may return NEW Modify the row before . This will change INSERT RETURNING or UPDATE RETURNING Returned data , And useful when the view cannot correctly display the same data provided to it .
For row level triggers triggered after an operation , The return value is ignored , So they can return NULL.
If more than one trigger is defined for the same event on the same relationship , They will be triggered in alphabetical order of their names . stay BEFORE and INSTEAD OF In the case of a trigger , The potentially modified row returned by each trigger becomes the input of the next trigger . If any one BEFORE or INSTEAD OF Trigger returns NULL, This operation will be disabled on this row and no subsequent triggers will be triggered for this row .
边栏推荐
- 8 free, HD, copyright free video material download websites are recommended
- 面试八股文整理版
- require. context
- Startup mode and scope builder of collaboration in kotlin
- How do it students find short-term internships? Which is better, short-term internship or long-term internship?
- Kotlin middle process understanding and Practice (II)
- Awk from getting started to being buried (2) understand the built-in variables and the use of variables in awk
- stm32F407-------DMA
- stm32F407-------DMA
- 【 tutoriel】 Chrome ferme les cors et les messages de la politique inter - domaines et apporte des cookies à travers les domaines
猜你喜欢
udp接收队列以及多次初始化的测试
stm32F407-------DMA
Return a tree structure data
4. 类和对象
Deep learning notes (constantly updating...)
UDP receive queue and multiple initialization test
Detailed introduction to the deployment and usage of the Nacos registry
How do it students find short-term internships? Which is better, short-term internship or long-term internship?
easyPOI
What are the key points often asked in the redis interview
随机推荐
leetcode961. Find the elements repeated N times in the array with length 2n
The Sandbox阐释对元宇宙平台的愿景
GBase 8c系统表-pg_authid
Awk from entry to burial (1) awk first meeting
[shutter] top navigation bar implementation (scaffold | defaulttabcontroller | tabbar | tab | tabbarview)
Detailed introduction to the deployment and usage of the Nacos registry
Leetcode(540)——有序数组中的单一元素
Deep learning notes (constantly updating...)
线程安全的单例模式
javeScript 0.1 + 0.2 == 0.3的问题
Leetcode 183 Customers who never order (2022.07.02)
5.文件操作
苏世民:25条工作和生活原则
elastic stack
stm32F407-------DMA
Memory pool (understand the process of new developing space from the perspective of kernel)
Pytorch convolution network regularization dropblock
Simple understanding of SVG
【教程】chrome關閉跨域策略cors、samesite,跨域帶上cookie
[shutter] bottom navigation bar implementation (bottomnavigationbar bottom navigation bar | bottomnavigationbaritem navigation bar entry | pageview)