1562
MariaDBERRORNotableReplicationHIGH confidence
Stored function prevents switching out of row-based replication
Production Risk
Low — the change is blocked safely.
What this means
Cannot change binlog_format away from ROW while a stored function is executing.
Why it happens
- 1A stored function is currently executing when a SET binlog_format statement is issued.
How to reproduce
trigger — this will error
trigger — this will error
-- Inside a stored function: SET GLOBAL binlog_format = 'STATEMENT';
expected output
ERROR 1562 (HY000): Cannot change the binlog direct flag inside a stored function or trigger
Fix
Change binlog_format outside stored routines
Change binlog_format outside stored routines
-- Change binlog_format before calling the function: SET GLOBAL binlog_format = 'STATEMENT'; CALL my_procedure();
Why this works
binlog_format changes must happen outside the scope of executing stored routines.
Sources
Official documentation ↗
MySQL 8.0 — 1562 ER_STORED_FUNCTION_PREVENTS_SWITCH_OUT_OF_RBR
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev