TY - GEN
T1 - Managing Database Trigger Design
AU - de Brock, Bert
N1 - Publisher Copyright:
© 2023, The Author(s), under exclusive license to Springer Nature Switzerland AG.
PY - 2023/7/2
Y1 - 2023/7/2
N2 - How to systematically check constraints in databases other than the standard constraints, e.g., (primary) keys and foreign keys? To solve this important problem in practice, one can use triggers, i.e., special database procedures that automatically start (‘fire’) upon attempts to modify data in a table. In practice, designing, writing, and maintaining triggers consistently is subtle, difficult, and error-prone, for many reasons: E.g., when multiple triggers are activated ‘at the same time’ or different trigger-types are mixed, the behaviour can become quite subtle or unpredictable, e.g., regarding their execution-order. Or when triggers invoke external actions, the triggering transaction might not be committed after all. Moreover, keeping triggers consistent when they must be changed is also very error-prone. So, it is very desirable to be able to (re)generate such triggers in a disciplined way. Therefore, our research question is how to manage the proper execution of checking constraints in database practice. To tackle these problems, we systematically assemble the triggers that should be activated ‘at the same time’ into one trigger. In that way, we keep control over what happens, and when. It keeps the trigger-order platform-independent as well. Using standard templates, we describe a generic way for generating triggers from a declarative specification. We intensively used and evaluated this approach in practice. Constraints between and within tables can be treated in this way. Using triggers, we also propose a straightforward implementation of SQL’s assertions. To develop triggers consistently, several design-decisions must be made. E.g., should the trigger stop checking after detecting the first violation or find and mention all violations? And what to do when there is a violation? E.g., a rollback or some ‘repair’, e.g., a cascading delete? We discuss and answer all these questions.
AB - How to systematically check constraints in databases other than the standard constraints, e.g., (primary) keys and foreign keys? To solve this important problem in practice, one can use triggers, i.e., special database procedures that automatically start (‘fire’) upon attempts to modify data in a table. In practice, designing, writing, and maintaining triggers consistently is subtle, difficult, and error-prone, for many reasons: E.g., when multiple triggers are activated ‘at the same time’ or different trigger-types are mixed, the behaviour can become quite subtle or unpredictable, e.g., regarding their execution-order. Or when triggers invoke external actions, the triggering transaction might not be committed after all. Moreover, keeping triggers consistent when they must be changed is also very error-prone. So, it is very desirable to be able to (re)generate such triggers in a disciplined way. Therefore, our research question is how to manage the proper execution of checking constraints in database practice. To tackle these problems, we systematically assemble the triggers that should be activated ‘at the same time’ into one trigger. In that way, we keep control over what happens, and when. It keeps the trigger-order platform-independent as well. Using standard templates, we describe a generic way for generating triggers from a declarative specification. We intensively used and evaluated this approach in practice. Constraints between and within tables can be treated in this way. Using triggers, we also propose a straightforward implementation of SQL’s assertions. To develop triggers consistently, several design-decisions must be made. E.g., should the trigger stop checking after detecting the first violation or find and mention all violations? And what to do when there is a violation? E.g., a rollback or some ‘repair’, e.g., a cascading delete? We discuss and answer all these questions.
KW - Assertions in SQL
KW - Constraints Checking
KW - Database Triggers
KW - Design Decisions
KW - Generators
KW - Rollback
KW - Trigger Design
UR - http://www.scopus.com/inward/record.url?scp=85168769086&partnerID=8YFLogxK
U2 - 10.1007/978-3-031-36757-1_26
DO - 10.1007/978-3-031-36757-1_26
M3 - Conference contribution
AN - SCOPUS:85168769086
SN - 978-3-031-36756-4
T3 - Lecture Notes in Business Information Processing
SP - 352
EP - 364
BT - Business Modeling and Software Design
A2 - Shishkov, Boris
PB - Springer
T2 - 13th International Symposium on Business Modeling and Software Design, BMSD 2023
Y2 - 3 July 2023 through 5 July 2023
ER -