1623
MariaDBWARNINGNotableReplicationHIGH confidence
Statement using system function is unsafe for statement-based replication
Production Risk
Medium — non-deterministic results can cause replica divergence.
What this means
A statement uses a system function (such as RAND(), UUID(), or USER()) that is non-deterministic and may yield different results on the replica.
Why it happens
- 1Functions like RAND(), UUID(), FOUND_ROWS(), or ROW_COUNT() produce different values per call.
- 2The result depends on session state or timing not replicated to the replica.
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO t VALUES (UUID());
expected output
Warning 1623: Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.
Fix 1
Switch to ROW-based replication
Switch to ROW-based replication
SET SESSION binlog_format = 'ROW';
Why this works
ROW format logs the actual inserted value, not the function call.
Fix 2
Pre-compute the value in application code
Pre-compute the value in application code
-- generate UUID in application and pass as literal
INSERT INTO t VALUES ('550e8400-e29b-41d4-a716-446655440000');Why this works
Using a literal value is safe for statement-based replication.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1623 ER_BINLOG_UNSAFE_SYSTEM_FUNCTION
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev