Bug #39324 Stored procedures: Misleading error message
Submitted: 8 Sep 2008 18:12 Modified: 8 Sep 2008 19:39
Reporter: Matthias Leich Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.1,6.0 OS:Any
Assigned to: CPU Architecture:Any
Triage: Triaged: D4 (Minor)

[8 Sep 2008 18:12] Matthias Leich
Description:
The keyword 'alter' causes a misleading error message
when used as name for a label within a stored procedure.
Example:
CREATE PROCEDURE my_proc2()
column : BEGIN
SELECT @x;
END//
ERROR 42000: You have an error in your SQL syntax; ...
<--- This is the usual error message when using a
     keyword as name for a label.
CREATE PROCEDURE my_proc2()
alter : BEGIN
SELECT @x;
END//
ERROR 0A000: ALTER VIEW is not allowed in stored procedures
<--- Where is here a VIEW?

My environment:
- MySQL compiled from source (bugteam tree)
  ./BUILD/compile-pentium64-debug-max
- Intel Core2Duo (64 Bit)
- OpenSuSE 10.3 (64 Bit)
- 5.1.28-debug-log        shows the bug
  6.0.7-alpha-debug-log   shows the bug
  5.0.66-debug-log does show the expected error message !

How to repeat:
--disable_abort_on_error
delimiter //;
# Positive case
CREATE PROCEDURE my_proc2()
otto : BEGIN
SELECT @x;
END//
#
# Negative case with fine error message
CREATE PROCEDURE my_proc2()
column : BEGIN
SELECT @x;
END//
#
# Negative case with strange error message
CREATE PROCEDURE my_proc2()
alter : BEGIN
SELECT @x;
END//
delimiter ;//
[8 Sep 2008 19:54] Matthias Leich
I get error number 1314.
<some path>/mysql-test> grep 1314 ../include/*
../include/mysqld_ername.h:{ "ER_SP_BADSTATEMENT", 1314 },
../include/mysqld_error.h:#define ER_SP_BADSTATEMENT 1314
Is only the message wrong?
[11 Sep 2008 19:24] Omer Barnir
triage: setting tag to CHECKED