Bug #10935 MySQL Test: Creation of a stored procedure having a comment in its body fails
Submitted: 27 May 2005 21:56 Modified: 27 May 2005 23:13
Reporter: Disha Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.5-beta-nt OS:Linux (Redhat Linux 9.0)
Assigned to: CPU Architecture:Any

[27 May 2005 21:56] Disha
Description:
When we create a stored procedure with comment in its body.The stored procedure creation fails with an error message .

How to repeat:
1. Execute the script 'test1' from mysql-test.Following are the details of the script.

--disable_warnings
drop database if exists test1;
Drop table if exists t1;
Create database test1;
Use test1;
Create table t1(f1 int,f2 int);
Create procedure sp1()
Begin
#Test comment;
Select * from t1;
End//
show create procedure sp1//
call sp1()//

Observed : It gives an error message 'At line 7: query 'Create procedure sp1()
Begin #Test comment;' failed: 1064: 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 '' .

Expected Result: Script should execute successfully without any error message or warnings.

Actual Result: It gives an error message 'At line 7: query 'Create procedure sp1()
Begin #Test comment;' failed: 1064: 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 '' .
[27 May 2005 23:13] MySQL Verification Team
Please see that you need to use delimiter // before the line
you begin to create the procedure:

miguel@hegel:~/dbs/5.0$ bin/mysql -uroot    
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.7-beta-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> drop database if exists test1;
Query OK, 2 rows affected (0.03 sec)

mysql> Drop table if exists t1;
ERROR 1046 (3D000): No database selected
mysql> Create database test1;
Query OK, 1 row affected (0.00 sec)

mysql> Use test1;
Database changed
mysql> Create table t1(f1 int,f2 int);
Query OK, 0 rows affected (0.01 sec)

mysql> delimiter //
mysql> Create procedure sp1()
    -> Begin
    -> #Test comment;
    -> Select * from t1;
    -> End//
Query OK, 0 rows affected (0.01 sec)

mysql> show create procedure sp1//
+-----------+----------+--------------------------------------------------------------+
| Procedure | sql_mode | Create Procedure                                             |
+-----------+----------+--------------------------------------------------------------+
| sp1       |          | CREATE PROCEDURE `test1`.`sp1`()
Begin
Select * from t1;
End |
+-----------+----------+--------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> call sp1()//
Empty set (0.01 sec)

Query OK, 0 rows affected (0.01 sec)
[13 Jul 2005 11:40] Disha
This bug is a MySQLTest failure. This is a Test Suite Failure, where the test run crashes when scripts contains stored procedures with 'inline' comments.