Error
Error Code:
1787
MariaDB Error 1787: GTID Consistency and Temporary Tables
Description
This error indicates a conflict between enabling GTID consistency and attempting to create or drop temporary tables. It occurs when `@@GLOBAL.ENFORCE_GTID_CONSISTENCY` is set to 1, and `CREATE TEMPORARY TABLE` or `DROP TEMPORARY TABLE` statements are executed within an active transaction or with `AUTOCOMMIT` disabled. MariaDB requires these operations to be non-transactional and autocommitted to maintain GTID integrity.
Error Message
When @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1.
Known Causes
3 known causesTemporary Table Operations in Transaction
Executing `CREATE TEMPORARY TABLE` or `DROP TEMPORARY TABLE` statements after starting an explicit transaction (e.g., `START TRANSACTION`, `BEGIN`) and before `COMMIT` or `ROLLBACK`.
AUTOCOMMIT Disabled
The current session's `AUTOCOMMIT` setting is 0, meaning statements are implicitly part of a transaction until explicitly committed or rolled back, violating the requirement for temporary table operations.
Global GTID Consistency Enabled
The MariaDB server is configured with `@@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1`, which strictly enforces rules for GTID-safe operations to ensure replication integrity.
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