MySQL, Views, Procedures and Functions.
Having problem exporting Schemas to other computers due to DEFINER = 'OldCreator'@'%'
If the Schema have a default user change DEFINER = 'DefaultUser'@'%' will make it easier to export the Schema to another user or database.
Also change SQL Security from Definer to Invoker.
Example: function CountJumperOnPiggyType
DELIMITER ;;
CREATE DEFINER=`DefaultUser`@`%` FUNCTION `CountJumperOnPiggyType`(
`INPpt_ix` INT
) RETURNS int
READS SQL DATA
SQL SECURITY INVOKER
BEGIN
RETURN (SELECT ix, p_name FROM generic_piggy_jumper WHERE pt_ix=INPpt_ix)
;
END ;;
DELIMITER ;
CREATE DEFINER=`DefaultUser`@`%` FUNCTION `CountJumperOnPiggyType`(
`INPpt_ix` INT
) RETURNS int
READS SQL DATA
SQL SECURITY INVOKER
BEGIN
RETURN (SELECT ix, p_name FROM generic_piggy_jumper WHERE pt_ix=INPpt_ix)
;
END ;;
DELIMITER ;
Editing Views, Procedures and Function work best with HeidiSQL
No comments:
Post a Comment