CREATE FUNCTION error “This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA”

前端 未结 7 826
走了就别回头了
走了就别回头了 2021-01-01 17:17

Our database has a function to generate an order number. It reads a value from a Settings table, increments it, then returns the new value. For example:

CREA         


        
7条回答
  •  北海茫月
    2021-01-01 17:28

    Could I instead just flag the function as NO SQL to suppress the warning? I tried it and it worked. Will this cause any problem?

    According to this Mysql doc:

    Assessment of the nature of a function is based on the “honesty” of the creator: MySQL does not check that a function declared DETERMINISTIC is free of statements that produce nondeterministic results.

    So it's up to you. If you are sure the method won't cause any problem...

提交回复
热议问题