Common SQL Errors

MySQL Error 1785 ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE: How to Fix and Prevent

Galaxy Team
August 7, 2025

<p>The error occurs when an update mixes transactional and non-transactional tables while GTID consistency is enforced.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error code 1785?

<p>MySQL Error 1785: ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE appears when a statement updates MyISAM or other non-transactional tables in the same transaction as InnoDB tables while GTID consistency is ON. Use autocommit, isolate the update into its own single-statement transaction, or convert the non-transactional tables to InnoDB to resolve the problem.</p>

Error Highlights

Typical Error Message

Statement violates GTID consistency: Updates to

Error Type

Replication and Transaction Error

Language

MySQL

Symbol

ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE

Error Code

1785

SQL State

HY000

Explanation

Table of Contents

What is MySQL Error 1785: ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE?

MySQL raises error 1785 when GTID_MODE is ON and a statement violates Global Transaction ID (GTID) consistency rules by touching non-transactional tables in a multi-statement transaction.

The server blocks the query to guarantee that every transaction can be replicated deterministically across replicas.

When does this error occur?

The error shows up in three main situations: mixing MyISAM and InnoDB updates in one transaction, wrapping a non-transactional DML statement in an explicit multi-statement transaction, or combining DDL and DML on non-transactional tables.

Autocommit queries that only target non-transactional tables do not trigger the error.

Why is fixing it important?

Ignoring the error stalls application workflows and breaks replication flow. Fixing it maintains data integrity, keeps replicas in sync, and prevents application downtime.

Production environments with GTID-based replication demand strict consistency, so the fix should be applied before retrying the workload.

How does Galaxy help?

Galaxys SQL editor highlights mixed engine usage, offers AI suggestions to refactor statements, and lets teams share the corrected queries. Its version control tracks engine conversions, giving developers confidence before deploying changes.

Common Causes

Mixing Transactional and Non-Transactional Updates

Updating an InnoDB table and a MyISAM table in the same multi-statement transaction violates GTID rules.

Explicit BEGIN ... COMMIT Around MyISAM Tables

Wrapping non-transactional updates inside BEGIN and COMMIT creates a multi-statement transaction that GTID cannot safely replicate.

Autocommit Disabled Globally

Turning off autocommit forces every statement into a transaction, so even single updates to MyISAM tables will fail.

Cross-Engine Foreign Keys or Triggers

Triggers that modify a MyISAM table after changing an InnoDB table cause implicit mixed-engine transactions.

Related Errors

MySQL Error 1780: ER_GTID_UNSAFE_CREATE_DROP_TEMP_TABLE

Occurs when creating or dropping temporary tables in multi-statement transactions under GTID mode.

MySQL Error 1781: ER_GTID_UNSAFE_CREATE_SELECT

Raised when CREATE TABLE ... SELECT mixes DDL and DML with GTID enabled.

MySQL Error 1783: ER_GTID_UNSAFE_CREATE_DROP_TEMP_TABLE_IN_TRX

Triggered by temporary table operations inside explicit transactions.

FAQs

Can I simply disable GTID to bypass the error?

Disabling GTID removes the restriction but sacrifices replication consistency. It is better to fix the statement.

Does enabling autocommit always solve the problem?

Yes, if your statement touches only non-transactional tables. Mixed-engine updates still require separation or conversion.

How do I find all MyISAM tables that can cause this?

Run SHOW TABLE STATUS WHERE Engine = 'MyISAM' or query information_schema.TABLES to list them.

Will converting large MyISAM tables lock the database?

ALTER TABLE ... ENGINE=InnoDB is blocking in older versions. Use pt-online-schema-change or MySQL 8.0 instant ALTER to minimize downtime.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo