Bug #27841 Cannot place SOURCE command inside a version-specific comment
Submitted: 16 Apr 2007 0:48 Modified: 16 Apr 2007 5:56
Reporter: Baron Schwartz (Basic Quality Contributor) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:All OS:Any
Assigned to: CPU Architecture:Any
Tags: qc, SOURCE, version-specific comment

[16 Apr 2007 0:48] Baron Schwartz
Description:
The SOURCE command cannot be placed inside a version-specific comment.  I can't find any other command that can't be put there.  When I (incorrectly) follow the filename with a semicolon inside the comment, I get an extra error.

How to repeat:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.2.3-falcon-alpha MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql > /*!5000 SELECT VERSION() */;
+--------------------+
| VERSION()          |
+--------------------+
| 5.2.3-falcon-alpha | 
+--------------------+
1 row in set (0.00 sec)

mysql > /*!5000 SOURCE filename.sql */;
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 'SOURCE filename.sql */' at line 1
mysql > /*!5000 SOURCE filename.sql; */;
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 'SOURCE filename.sql' at line 1
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 '*/' at line 1

Suggested fix:
It seems to be a problem with the parser not knowing where the end of the filename is.  Maybe something in sql_yacc.yy?  I am not a yacc expert :)
[16 Apr 2007 5:56] Giuseppe Maxia
SOURCE is a keyword implemented client-side, not on the server
http://dev.mysql.com/doc/refman/5.0/en/mysql-commands.html
That's why it won't be recognized by the server