1👍
Ok, so typically this error occurs when previous statements in a transaction have created pending trigger events (these include foreign key references). Typically you want to make sure:
-
any
alter table
queries are near the beginning of the transaction, and -
you are aware of how the entire transaction flow runs.
Source:stackexchange.com