zoghal / PersianDate4MySQL

pDate is a Gregorian / Jalali(Shamsi) date convertor functions for MySQL 5.1+
http://saleh.soozanchi.ir/1388/07/05/%D8%AA%D9%88%D8%A7%D8%A8%D8%B9-%D8%AA%D8%A7%D8%B1%DB%8C%D8%AE-%D8%B4%D9%85%D8%B3%DB%8C-%D8%AC%D9%87%D8%AA-%D8%A7%D8%B3%D8%AA%D9%81%D8%A7%D8%AF%D9%87-%D8%AF%D8%B1-mysql/
182 stars 67 forks source link

Problem with deterministic flags #23

Open creativefctr opened 6 years ago

creativefctr commented 6 years ago

Hi, In new versions of MySQL and MariaDB running the SQL file creates this error for each function:

#1418 - This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

When you create a stored function, you must declare either that it is deterministic or that it does not modify data. Otherwise, it may be unsafe for data recovery or replication.

By default, for a CREATE FUNCTION statement to be accepted, at least one of DETERMINISTIC, NO SQL, or READS SQL DATA must be specified explicitly. Otherwise, an error occurs:

To fix this issue add following lines After Return and Before Begin statement:

READS SQL DATA
DETERMINISTIC

For Example :

CREATE FUNCTION f2()
RETURNS CHAR(36) CHARACTER SET utf8
/*ADD HERE */
READS SQL DATA
DETERMINISTIC
BEGIN

This should be added to all functions, I modified it manually. Please update the main repo. Thanks