Trigger calls in cascade deleting(在级联删除中触发调用)
问题描述
我在 MySQL 中有表A".它有一些对其他一些表(B"、C"、D"...)的级联删除的引用.当某些内容从A"中删除时,我需要使用触发器.当我直接从A"删除记录时,此触发器起作用.但它不适用于级联删除.是否存在任何版本的 MySQL,我的触发器可以与级联删除一起使用?或者,也许还有另一种调用方式
I have table "A" in MySQL. It has some references with cascade deleting to some other tables ("B", "C", "D" ...). I need to use a trigger when something deletes from "A". This trigger works when I delete records from "A" directly. But it doesn't work with cascade deleting. Does any version of MySQL exist where my trigger will work with cascade deleting? Or, maybe, there is another way to call
推荐答案
来自http://dev.mysql.com/doc/refman/5.6/en/innodb-restrictions.html
级联外键操作不会激活触发器
Cascaded foreign key actions do not activate triggers
换句话说,您不能将触发器与级联删除一起使用.
In other words, you cannot use the trigger with cascaded deleting.
另见相关错误:
- MySQL:https://bugs.mysql.com/bug.php?id=11472
- MariaDB:https://jira.mariadb.org/browse/MDEV-19402
这篇关于在级联删除中触发调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在级联删除中触发调用


基础教程推荐
- SQL Server 2016更改对象所有者 2022-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01