Last answered:

25 Mar 2022

Posted on:

10 May 2021

2

Error Code: 1418 while creating function

Hi,

I received the below error while creating the function, how do i disable it so that i can create the function?

Error Code: 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)

Thank you

5 answers ( 0 marked as helpful)
Instructor
Posted on:

10 May 2021

5

Hi Jaycus!

Thanks for reaching out.

Some distributions of MySQL are set to check if a function or procedure wants to modify the data (which is not the case with our function, but MySQL still checks it).

This can be undone by executing this command:

SET GLOBAL log_bin_trust_function_creators = 1;

Try creating the function after that and tell us if it's working.

Hope this helps.
Best,
Martin

Posted on:

10 May 2021

0

Hi Martin,

Yes, it works now. Thank you!

Instructor
Posted on:

11 May 2021

1

Hi Jaycus!

Thanks for your reply.

Thank you for letting us know you can proceed with the course!

Good luck and please feel free to post another question should you encounter any difficulties. Thank you.

Best,
Martin,
The 365 Team




Posted on:

25 Mar 2022

0

Working on production databases, this logging will probably be enabled?
How should the function be designed in order to comply with MySQL validations and error handling?

Instructor
Posted on:

25 Mar 2022

0

Hi Michael!

Thanks for reaching out (and pointing this out!).

Probably yes, it will, so you'd be just required to add at least one of the following 3 specifications (DETERMINISTIC, NO SQL, READS SQL DATA) in the queries:

DELIMITER $$
CREATE FUNCTION ...
DETERMINISTIC, NO SQL, READS SQL DATA
...

Otherwise, you should be able to remove the logging by executing the following command:

SET GLOBAL log_bin_trust_function_creators = 0;

Hope this helps.Best,
Martin

Submit an answer