1418 error about MySQL

when testing the statement that creates the function locally, there is no error. In production, 1418 error is reported, as shown in the following figure

clipboard.png
(picture from network)

searched https://blog.csdn.net/yown/ar. and http://blog.sina.com.cn/s/blo., I probably understood the reason
and decided to add the declaration of function type, but I still have some questions about how to choose the value. Here are three common functions. How to choose the function type, thank you!

CREATE FUNCTION currval(v_seq_name VARCHAR(50)) RETURNS int(11)
READS SQL DATA
BEGIN
    DECLARE val INTEGER;
    SET val = 0;
    SELECT current_val INTO val FROM sequence WHERE seq_name = v_seq_name;
    RETURN val;
END;
CREATE FUNCTION nextval(v_seq_name VARCHAR(50)) RETURNS int(11)
-- DETERMINISTIC
DETERMINISTIC
BEGIN
    UPDATE sequence
    SET current_val = current_val + increment_val
    WHERE seq_name = v_seq_name;
    RETURN currval (v_seq_name);
END;
CREATE FUNCTION split_str(
    x VARCHAR (1000),
    delim VARCHAR (10),
    pos INT
) RETURNS varchar(1000)
NO SQL
RETURN REPLACE (
    SUBSTRING(
        SUBSTRING_INDEX(x, delim, pos),
        LENGTH(
            SUBSTRING_INDEX(x, delim, pos - 1)
        ) + 1
    ),
    delim,
    ""
);
May.06,2021

your type selection is correct. DETERMINISTIC means that there will be a definite result after the operation, so that the result will be the same after the execution of the master library and the slave library. There are usually two cases of uncertain results: the introduction of time variables or random variables. Because the execution time of the master library is different from that of the slave library, the result is not the same. At this point, the text execution log is invalid, in which case bin log.

should be used.
Menu