Error
Error Code:
1786
MariaDB Error 1786: GTID Unsafe CREATE TABLE SELECT
Description
This error occurs when attempting to execute a `CREATE TABLE ... SELECT` statement while the `ENFORCE_GTID_CONSISTENCY` global system variable is enabled (set to 1). MariaDB prevents this operation to maintain the integrity and consistency of Global Transaction Identifiers (GTIDs) for replication.
Error Message
CREATE TABLE ... SELECT is forbidden when @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1.
Known Causes
3 known causesGTID Consistency Enabled
The MariaDB server is configured with `ENFORCE_GTID_CONSISTENCY` set to `ON`, which strictly disallows operations that could compromise GTID-based replication.
Execution of GTID-Unsafe Statement
The `CREATE TABLE ... SELECT` statement is inherently considered unsafe for GTID replication, as its behavior might not be deterministic across replicas.
Replication Environment Setup
The database instance is likely part of a replication topology where GTIDs are critical for ensuring data integrity and failover capabilities.
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