<p>CREATE TABLE ... SELECT is not allowed with GTID_MODE=ON because it can break deterministic replication.</p>
<p>MySQL Error 1786 ER_GTID_UNSAFE_CREATE_SELECT happens when you run CREATE TABLE ... SELECT while GTID mode is enabled. Split the operation into CREATE TABLE plus INSERT SELECT, or temporarily disable GTID mode to solve the problem.</p>
Statement violates GTID consistency: CREATE TABLE ...
Error 1786 fires when a CREATE TABLE ... SELECT statement runs while GTID_MODE is ON. MySQL blocks the query because it cannot guarantee deterministic replication across servers.
GTID based replication requires every transaction to be uniquely identifiable and deterministic. A single statement that both creates a table and selects data can behave differently on source and replica, violating this guarantee.
Leaving the error unresolved halts the transaction, prevents table creation, and can break deployment scripts. In an automated pipeline this blockage cascades into application downtime or failed CI builds.
The error appears on MySQL 5.6.5 and later whenever GTID_MODE=ON and a CREATE TABLE ... SELECT is issued without the appropriate workarounds.
GTID_MODE set to ON or ON_PERMISSIVE disallows non deterministic statements such as CREATE TABLE ... SELECT.
Using mixed or statement based replication with GTIDs amplifies the non deterministic nature of the combined create-select syntax.
Older dump or migration tools often generate CREATE TABLE ... SELECT, unaware of modern GTID restrictions.
Occurs when a delimiter command is unsafe under GTID mode.
Triggered by updates to non transactional tables during GTID enforced sessions.
Altering or dropping a temporary table is blocked under GTID mode.
No. Ignoring it leaves the table uncreated and the transaction uncommitted. Fix or disable GTIDs first.
Yes. The rule applies to all versions that support GTIDs because the operation is nondeterministic.
Row based logging allows the statement but changes replication size and performance. Test before switching.
Galaxy flags unsafe statements in the editor and suggests deterministic rewrites, preventing the error before execution.