Error
Error Code: 1786

MariaDB Error 1786: GTID Unsafe CREATE TABLE SELECT

📦 MariaDB
📋

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 causes
⚠️
GTID 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 Soon

Detailed step-by-step solutions for this error are being prepared. In the meantime, try these general troubleshooting tips:

General 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
🔗

Related Errors

5 related errors