When I use the "Export database as SQL" feature to copy a complete database into the other, the functions and procedures generate this error:
SQL Error 1227: Access denied; you need the SUPER privilege for this operation
While the error message is self-explanatory (if I assign such privilege the operation completes flawlessly) I can't understand why it's required since I don't need it to create the objects in the first place. If I run the CREATE code manually in the target database MySQL doesn't complaint.
This is the code for one of the routines:
CREATE PROCEDURE `actualizar_categoria_nivel`()
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY INVOKER
COMMENT 'Actualiza los valores de la tabla categoria_nivel'
BEGIN
/*
* Reconstruye los datos de la tabla categoria_nivel
*
* http://explainextended.com/2009/03/17/hierarchical-queries-in-mysql/
*/
DELETE FROM categoria_nivel;
INSERT INTO categoria_nivel (categoria_id, categoria_padre_id, nivel)
SELECT hi.categoria_id, categoria_padre_id, nivel
FROM (
SELECT categoria_connect_by_parent_eq_prior_id(categoria_id) AS categoria_id, @nivel AS nivel
FROM (
SELECT @start_with := 0,
@categoria_id := @start_with,
@nivel := 0
) vars, categoria
WHERE @categoria_id IS NOT NULL
) ho
JOIN categoria hi ON hi.categoria_id = ho.categoria_id;
END