Bug #14723 Dumping of stored functions seems to cause corruption in the function body
Submitted: 7 Nov 2005 22:14 Modified: 20 Nov 2005 3:38
Reporter: Matthew Lord Email Updates:
Status: Closed Impact on me:
None 
Category:Instance Manager Severity:S1 (Critical)
Version:5.0.16-snapshot (2005-11-05) OS:Linux (linux (RH 9, RHEL 4))
Assigned to: Per-Erik Martin CPU Architecture:Any

[7 Nov 2005 22:14] Matthew Lord
Description:
When trying to dump a database along with the stored routines you get a syntax error from show create function; and the function body seems to be corrupted.

From what I can tell a "/*" is appended to the end of the function body which is causing the problems.

How to repeat:
mysqladmin create dprimary
mysql < dprimary1.sql
mysql < dprimary < get_nt_av_key.sql
mysqldump -B dprimary -r /tmp/dump.sql --routines --triggers
[10 Nov 2005 14:04] Per-Erik Martin
It seems the /*!50003 ...*/ parsing goes wrong when there is a label at the first begin.
These two end up with with a trailing '*/' in the body:

delimiter ;;
/*!50003 create function bug14723_1()
 returns bigint(20)
main_loop: begin
  return 42;
end */;;
delimiter ;

delimiter ;;
/*!50003 create procedure bug14723_1()
main_loop: begin
  select 42;
end */;;
delimiter ;

while either removing the /*!50003 ... */ wrapper or the label works.
[11 Nov 2005 10:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/32174
[15 Nov 2005 12:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/32267
[15 Nov 2005 14:13] Per-Erik Martin
Pushed to 5.0.16 release clone, and 5.0.17 bk.
[15 Nov 2005 14:15] Per-Erik Martin
Note: Pushed (by agreement) with an unrelated test failure: type_newdecimal.test.
[20 Nov 2005 3:38] Paul DuBois
Noted in 5.0.16 changelog.