MySQL 文档澄清;触发器访问另一个表

标签 mysql triggers

这是否意味着如果我使用 MySQL < 5.0.10,我无法从触发器更新另一个表

MySQL documentation:

Note Before MySQL 5.0.10, triggers cannot contain direct references to tables by name. Beginning with MySQL 5.0.10, you can write triggers such as the one named testref shown in this example...

最佳答案

这是正确的。 This FAQ以更明确的方式陈述这一事实:

Before MySQL 5.0.10, a trigger cannot modify other tables

请注意the following limitation仍然存在于 v5.5 和 v5.6 中:

A trigger (...) is not permitted to modify a table that is already being used (for reading or writing) by the statement that invoked the function or trigger.

关于MySQL 文档澄清;触发器访问另一个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11143689/

相关文章:

mysql - 在 Fedora 操作系统上将所有命令行输入通过管道传输到文件的 mysql 命令是什么?

mysql - 无法将 .sql 文件导入到服务器

mysql - MySQL 中的这个错误是什么意思?

sql-server - 如何防止更新表,一种情况除外

mysql - 如何使用触发器来增加或减少mysql中的库存

python - 在 Python 中,如何替换字符串中的所有非 UTF-8 字符?

mysql - 删除一个条目时自动删除一个条目mysql

Android 事务或触发器?

sql - 删除前触发 Firebird

mysql - MySQL触发器出了什么问题