1621
MariaDBWARNINGNotableReplicationHIGH confidence
Statement using UDF is unsafe for statement-based replication
Production Risk
Medium — replica may diverge silently.
What this means
A statement using a user-defined function (UDF) may produce different results on replicas because UDFs are non-deterministic by nature.
Why it happens
- 1UDFs are non-deterministic and may not produce the same output on the replica.
- 2The UDF depends on external state, environment variables, or random values.
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO t SELECT my_udf(col) FROM src;
expected output
Warning 1621: Statement is unsafe because it uses a user-defined function that may not return same results on the slave.
Fix
Switch to row-based replication
Switch to row-based replication
SET SESSION binlog_format = 'ROW';
Why this works
Row-based replication logs the actual row changes, eliminating non-determinism.
Sources
Official documentation ↗
MySQL 8.0 — 1621 ER_BINLOG_UNSAFE_UDF
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev