Bug #6063 Stored procedure labels are subject to restrictions
Submitted: 13 Oct 2004 12:13 Modified: 6 Mar 2010 18:42
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Konstantin Osipov CPU Architecture:Any

[13 Oct 2004 12:13] Peter Gulutzan
Description:
Within a stored procedure, a label should be subject to the usual rules for identifiers -- 
can't be a reserved word, can't be all digits, etc. But there are additional restrictions that 
should not exist: (1) words like LABEL are disallowed even though they're not officially 
reserved, (2) special characters, even latin1 characters, are disallowed. 
 
I am aware that LABEL is a special addition for GOTO support, as in 
create procedure p7 ()  begin label x; goto x; end;// 
but that's undocumented, and in any case it is wrong to say that a word 
is sometimes allowable as an identifier, sometimes not. 
 

How to repeat:
mysql> create procedure p1 () label1: begin end// 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create procedure p2 () label: 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 ': begin end' at 
line 1 
mysql> create procedure p3 () lâbel: 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 'lâbel: begin 
end' at line 1
[10 Aug 2008 17:14] Konstantin Osipov
Susanne, could you please re-verify this bug? If it is fixed, please assign back to me, I will add a test case.
[11 Aug 2008 7:37] Susanne Ebrecht
I used 5.0 bzr tree from today:

select version();

5.0.68-debug

My environment is utf8:

set names utf8;

delimiter //

create procedure p1 () label1: begin end// 
Query OK, 0 rows affected (0.01 sec)

create procedure p2 () label: begin end// 
Query OK, 0 rows affected (0.00 sec)

create procedure p3 () lâbel: begin end//
Query OK, 0 rows affected (0.00 sec)

create procedure p4 () läbel: begin end//
Query OK, 0 rows affected (0.00 sec)

create procedure p5() labél: begin end//
Query OK, 0 rows affected (0.00 sec)

create procedure p6() labël: begin end//
Query OK, 0 rows affected (0.00 sec)

create procedure p7() labèl: begin end//
Query OK, 0 rows affected (0.00 sec)

create procedure p8() lâbél: begin end//
Query OK, 0 rows affected (0.00 sec)

create procedure p9() läbël: begin end//
Query OK, 0 rows affected (0.00 sec)
[27 Jun 2009 17:07] Konstantin Osipov
The test case is enabled, closing the bug.
[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:35] 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
[20 Nov 2009 13:12] Magne Mæhre
Backported to 5.6.0, and pushed to next-mr-runtime
(6.0-codebase revid: 2617.57.1)
[6 Mar 2010 10:56] 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:42] Paul DuBois
Changes to test case. No changelog entry needed.