Bug #11445 mysqldump does not backup userdefined functions/stored procedures
Submitted: 20 Jun 2005 7:10 Modified: 20 Jun 2005 12:32
Reporter: Jan Bouwhuis Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S3 (Non-critical)
Version:5.0.7-beta-nt OS:Windows (Windows 2003 SP1/XP SP2)
Assigned to: CPU Architecture:Any

[20 Jun 2005 7:10] Jan Bouwhuis
Description:
When performing a full backup using the mysqldump utility (root account) only tables, views and data is exported.
Applies to MySQL dump 10.10, distributed with MySQL server 5.0.7-beta-nt

How to repeat:
CREATE DATABASE /*!32312 IF NOT EXISTS*/ test;
USE test;
CREATE TABLE `testtable` (
  `testid` int(10) unsigned NOT NULL auto_increment,
  PRIMARY KEY  (`testid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `testtable` (`testid`) VALUES 
 (1),
 (2),
 (3),
 (4),
 (5);

DELIMITER $$

DROP PROCEDURE IF EXISTS `test`.`insertid`$$
CREATE PROCEDURE `test`.`insertid`(ID INT(11))
BEGIN
  INSERT into testtable (testid) values (ID);
END$$

CREATE FUNCTION `test`.`doubleid`(ID INT(11)) RETURNS int(11)
BEGIN
  DECLARE RETID INT(11);
  SET  RETID = (SELECT (testid * 2) FROM testtable WHERE testid = ID);
  RETURN RETID;
END$$

DELIMITER ;

#############################################

Now dump de database using:
mysqldump.exe --user root --password password test>backup_test.sql

Suggested fix:
Support dump/restore for stored procedures and user defined functions.
MySQL Administrator 1.0.21 is also missing functionality to perform a dump of UDF and SP. Even Views are not exported.
[20 Jun 2005 7:27] Jan Bouwhuis
See also bug: 11446
[20 Jun 2005 12:32] MySQL Verification Team
Related to:

http://bugs.mysql.com/bug.php?id=10329
http://bugs.mysql.com/bug.php?id=9056
[24 Nov 2006 7:28] harishdahal
yeah it is true.
even i have the same problem mysqldump doesn't backup stored procedures and functions
is the bug or do we have some solution to it
please help