Bug #7088 Stored procedures: labels won't work if character set is utf8
Submitted: 7 Dec 2004 23:49 Modified: 6 Mar 2010 18:41
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.3-alpha-debug OS:Linux (SUSE 9.2)
Assigned to: CPU Architecture:Any

[7 Dec 2004 23:49] Peter Gulutzan
Description:
I have simple labels in a stored procedure, e.g. 'label1:'. 
If I say "SET CHARACTER SET UTF8" before the CREATE PROCEDURE, 
the CREATE PROCEDURE fails. 
 

How to repeat:
mysql> delimiter // 
mysql> set character set latin1// 
Query OK, 0 rows affected (0.01 sec) 
 
mysql> create procedure p81 () label1: begin end// 
Query OK, 0 rows affected (0.01 sec) 
 
mysql> set character set utf8// 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create procedure p82 () label1: begin end// 
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near 'label1: begin 
end' at line 1
[8 Dec 2004 0:19] MySQL Verification Team
Thank you for the bug report.
[1 Apr 2005 19:28] Peter Gulutzan
(Comment moved from another bug which is now labelled as duplicate)

Switching to utf8 also affects existing procedures with labels:

mysql> set names latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> create procedure pl () label1: begin end;
Query OK, 0 rows affected (0.00 sec)

mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> drop procedure pl;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'label1: ...
mysql> set names latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> drop procedure pl;
Query OK, 0 rows affected (0.01 sec)
[1 Jul 2005 23:32] Roland Bouman
Ok, it seems that my submission 11653 (which could not be repeated) is also solved by setting the character set to latin1 (my server default was -and still is- utf8). I'm running this on Win XP. 
I'm also unable to drop the procedure unless i explicitly set the character set to latin 1
[6 Jul 2005 15:07] 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/26725
[11 Jul 2005 17:45] Per-Erik Martin
Pushed to 5.0.10.
[14 Jul 2005 16:28] Paul DuBois
Noted in 5.0.10 changelog.
[3 Jul 2009 6:13] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090702084644-k95gd2asolvz2zpu) (version source revid:holyfoot@mysql.com-20090626091141-s0jhc72bbgyqudc3) (merge vers: 5.4.4-alpha) (pib:11)
[9 Jul 2009 7:34] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090702084644-k95gd2asolvz2zpu) (version source revid:holyfoot@mysql.com-20090626091141-s0jhc72bbgyqudc3) (merge vers: 5.4.4-alpha) (pib:11)
[20 Nov 2009 13:10] 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/commits/91082
[6 Mar 2010 11:02] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20091125142014-7asc9sj33gzki0ym) (merge vers: 5.6.0-beta) (pib:16)
[6 Mar 2010 18:41] Paul DuBois
Noted in 5.5.3 changelog.