I didn't appreciate PythonAnywhere was still using MySQL version 5 and used two functions - BIN_T|O_UUID and UUID_TO_BIN that are available on my development version (8.0.24) but not on version 5
I found two functions that can provide the same functionality, but I get the error message when trying to create them:
Error Code: 1419. You do not have the SUPER privilege and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable)
If I try to use the suggested solution:
set global log_bin_trust_function_creators=1;
I also get:
Error Code: 1227. Access denied; you need (at least one of) the SUPER privilege(s) for this operation
Version 8 has been available now for well over 3 years. What are the plans to upgrade to - or offer at least, in the way we can choose what version of Python we use - MySQL 8?
Can you install these functions on two databases for me please?
DELIMITER $$ CREATE FUNCTION BIN_TO_UUID(b BINARY(16), f BOOLEAN) RETURNS CHAR(36) DETERMINISTIC BEGIN DECLARE hexStr CHAR(32); SET hexStr = HEX(b); RETURN LOWER(CONCAT( IF(f,SUBSTR(hexStr, 9, 8),SUBSTR(hexStr, 1, 8)), '-', IF(f,SUBSTR(hexStr, 5, 4),SUBSTR(hexStr, 9, 4)), '-', IF(f,SUBSTR(hexStr, 1, 4),SUBSTR(hexStr, 13, 4)), '-', SUBSTR(hexStr, 17, 4), '-', SUBSTR(hexStr, 21) )); END$$ CREATE FUNCTION UUID_TO_BIN(uuid CHAR(36), f BOOLEAN) RETURNS BINARY(16) DETERMINISTIC BEGIN RETURN UNHEX(CONCAT( IF(f,SUBSTRING(uuid, 15, 4),SUBSTRING(uuid, 1, 8)), SUBSTRING(uuid, 10, 4), IF(f,SUBSTRING(uuid, 1, 8),SUBSTRING(uuid, 15, 4)), SUBSTRING(uuid, 20, 4), SUBSTRING(uuid, 25)) ); END$$ DELIMITER ;