mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-24617 OPTIMIZE on a sequence causes unexpected ER_BINLOG_UNSAFE_STATEMENT
The warning out of OPTIMIZE Statement is unsafe because it uses a system function was indeed counterfactual and was resulted by checking an insufficiently strict property of lex' sql_command_flags. Fixed with deploying an additional checking of weather the current sql command that modifes a share->non_determinstic_insert table is capable of generating ROW format events. The extra check rules out the unsafety to OPTIMIZE et al, while the existing check continues to do so to CREATE TABLE (which is perculiarly tagged as ROW-event generative sql command). As a side effect sql_sequence.binlog test gets corrected and binlog_stm_unsafe_warning.test is reinforced to add up an unsafe CREATE..SELECT test.
This commit is contained in:
@@ -189,8 +189,20 @@ SHOW WARNINGS;
|
||||
SELECT sf_bug50192();
|
||||
SHOW WARNINGS;
|
||||
|
||||
# The test proves MDEV-24617 fixes leave in force
|
||||
# unsafe warnings in non-deterministic CREATE..SELECT cases.
|
||||
# Below an inserted default value to `b` of the target table is replication
|
||||
# unsafe. A warning must be out.
|
||||
CREATE TABLE t3 (a INT(11) DEFAULT NULL);
|
||||
INSERT INTO t3 VALUES (1);
|
||||
CREATE TABLE t4 (a INT(11) DEFAULT NULL, b BIGINT(20) DEFAULT uuid_short()) SELECT * FROM t3;
|
||||
SHOW WARNINGS;
|
||||
# no warning out of a deterministic "rhs" of SELECT
|
||||
CREATE OR REPLACE TABLE t4 (a INT(11) DEFAULT NULL) SELECT * FROM t3;
|
||||
SHOW WARNINGS;
|
||||
|
||||
# cleanup
|
||||
|
||||
DROP FUNCTION sf_bug50192;
|
||||
DROP TRIGGER tr_bug50192;
|
||||
DROP TABLE t1, t2;
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
|
Reference in New Issue
Block a user