Error
Error Code:
1685
MariaDB Error 1685: Session Variable Modification in Transaction
Description
This error signifies an attempt to modify the `@@session.binlog_direct_non_transactional_updates` system variable while an active transaction is in progress. MariaDB prevents this specific modification mid-transaction to ensure data consistency and integrity, particularly concerning how non-transactional updates are logged.
Error Message
Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
Known Causes
3 known causesModifying Variable Within Active Transaction
This error most commonly occurs when a `SET @@session.binlog_direct_non_transactional_updates` statement is executed after a `START TRANSACTION` or `BEGIN` statement, but before a `COMMIT` or `ROLLBACK`.
Incorrect Application Logic
Automated scripts or application code might be structured to set session variables mid-transaction, not realizing the implications for this specific variable's transactional restrictions.
Stored Procedure or Trigger Execution
A stored procedure or trigger might inadvertently attempt to alter the `@@session.binlog_direct_non_transactional_updates` variable while it's executing within the context of an ongoing transaction.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service