1619
MariaDBWARNINGNotableReplicationHIGH confidence

Statement accessing system tables is unsafe for replication

Production Risk

Medium — replication safety is compromised; consider switching to MIXED or ROW format.

What this means

A statement mixes writes to user tables and reads or writes to system tables, making it unsafe for statement-based replication.

Why it happens
  1. 1A DML statement simultaneously modifies user tables and accesses mysql schema system tables.
  2. 2Statements that mix transactional user tables with system table reads in STATEMENT binlog mode.
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO my_table SELECT user FROM mysql.user WHERE host = 'localhost';

expected output

Warning 1619: Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.

Fix 1

Use ROW or MIXED binlog format

Use ROW or MIXED binlog format
SET GLOBAL binlog_format = 'MIXED';

Why this works

MIXED format automatically switches to row-based logging for unsafe statements.

Fix 2

Separate the system table read from the user table write

Separate the system table read from the user table write
-- Read system table data into an application variable, then insert separately.

Why this works

Decoupling the system table access from the DML eliminates the unsafe combination.

Sources
Official documentation ↗

MySQL 8.0 — 1619 ER_BINLOG_UNSAFE_SYSTEM_TABLE

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

← All MariaDB errors