3084
MariaDBERRORNotableReplicationHIGH confidence

Cannot change sql_log_bin inside a transaction

Production Risk

High — if misused, can cause replication gaps.

What this means

The sql_log_bin session variable cannot be changed while a transaction is open.

Why it happens
  1. 1Attempting SET SESSION sql_log_bin = 0/1 inside an active transaction.
How to reproduce
trigger — this will error
trigger — this will error
START TRANSACTION;
SET SESSION sql_log_bin = 0;

expected output

ERROR 3084 (HY000): Cannot change the sql_log_bin inside a transaction.

Fix

Change sql_log_bin before starting the transaction

Change sql_log_bin before starting the transaction
SET SESSION sql_log_bin = 0;
START TRANSACTION;
-- DML statements
COMMIT;
SET SESSION sql_log_bin = 1;

Why this works

Setting sql_log_bin outside the transaction boundary is allowed.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3084 ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN2

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors