当前位置:网站首页>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 .
边栏推荐
- GBase 8c触发器(二)
- Su Shimin: 25 principles of work and life
- Unrecognized SSL message, plaintext connection?
- 通达OA v12流程中心
- 详细些介绍如何通过MQTT协议和华为云物联网进行通信
- Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque
- GBase 8c系统表-pg_amproc
- Packing and unpacking of JS
- javeScript 0.1 + 0.2 == 0.3的问题
- stm32F407-------DMA
猜你喜欢
UDP receive queue and multiple initialization test
8 free, HD, copyright free video material download websites are recommended
MySQL learning 03
easyExcel
Trial setup and use of idea GoLand development tool
SPI机制
詳細些介紹如何通過MQTT協議和華為雲物聯網進行通信
线程安全的单例模式
Pytorch convolution network regularization dropblock
基于线程池的生产者消费者模型(含阻塞队列)
随机推荐
《上市风云》荐书——唯勇气最可贵
easyExcel
苏世民:25条工作和生活原则
力扣(LeetCode)183. 从不订购的客户(2022.07.02)
[codeforces] cf1338a - Powered addition [binary]
Face recognition 6-face_ recognition_ Py based on OpenCV, face detection and real-time tracking using Haar cascade and Dlib Library
Gbase 8C system table PG_ cast
awk从入门到入土(0)awk概述
What are MySQL locks and classifications
Introduce in detail how to communicate with Huawei cloud IOT through mqtt protocol
Qt之QComboBox添加QCheckBox(下拉列表框插入复选框,含源码+注释)
内存池(内核角度理解new开辟空间的过程)
Monitoring and management of JVM
Return a tree structure data
Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
The Sandbox阐释对元宇宙平台的愿景
Javescript 0.1 + 0.2 = = 0.3 problem
Machine learning process and method
Packing and unpacking of JS
GBase 8c系统表-pg_aggregate