Search code examples
mysqlgoogle-cloud-platformgoogle-cloud-sql

Google CloudSQL 2nd Generation create Function not working


For a Google CloudSQL 2nd generation instance, with Failover replication was enabled. After that when tried to import the database it is not allowing to create the procedure. Receiving below error.

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)

Is it true that CloudSQL with failover will not support function ?

Sample execute query

DELIMITER ;;
CREATE FUNCTION `stutzen`(amount INT) RETURNS int(11)
    DETERMINISTIC
BEGIN
    DECLARE charges FLOAT DEFAULT 1.0;
    SELECT valuesettings INTO charges FROM dreamer_tbl WHERE namesettings='stutzen.co';
    RETURN FLOOR((amount / 100) * charges) ;
END ;;
DELIMITER ;

Solution

  • Google Cloud SQL support both, stored procedures and functions.

    In your case the problem seems to be that you're trying to import a sql file that has some kind of routine that needs the SUPER privilege, and this is not permitted.