I have a stored procedure to merge and dedup records. it executes updates dozens of tables and also deletes rows from other tables when a merge is completed.
When the script fails it is always because there's foreign key reference I've forgotten to integrate into the script (large schema; hundreds of tables).
Previously, MySQL 5.7 would return the name of the specific foreign key via the MESSAGE_TEXT variable. MySQL 8 doesn't appear to do this.
How can I get the specific foreign key that is causing the record from being deleted?