1570
MariaDBERRORNotableTransactionsHIGH confidence

Cannot change transaction characteristics mid-transaction

Production Risk

Low — the SET fails; the active transaction continues with original characteristics.

What this means

Transaction characteristic cannot be changed once a transaction has already started.

Why it happens
  1. 1Calling SET TRANSACTION ISOLATION LEVEL or SET TRANSACTION READ ONLY/READ WRITE inside an active transaction.
How to reproduce
trigger — this will error
trigger — this will error
START TRANSACTION;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

expected output

ERROR 1570 (HY000): Transaction characteristics can't be changed while a transaction is in progress

Fix

Set transaction characteristics before starting the transaction

Set transaction characteristics before starting the transaction
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
START TRANSACTION;

Why this works

Transaction-level characteristics must be set before BEGIN or START TRANSACTION.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 1570 ER_CANT_CHANGE_TX_CHARACTERISTICS

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

← All MariaDB errors