While browsing a SQL dump generated by the program SQLYog for a MySQL 5.6.16 database, I noticed that every stored procedure CREATE
statement was surrounded by comment characters (/* */
). However, the stored procedures were created when the SQL script was executed.
I was surprised both to see the comments surrounding the stored procedure CREATE
statements, and then to see that these commented statements were, in fact, executed.
Seeing that this did occur, I assumed that in fact either the SQL standard, MySQL itself, or SQLYog specifically, documents that it supports the execution of at least some commented SQL code.
This caused me to search for the specification documentation laying out the details regarding the fact that some commented code blocks are executed when the SQL script is run. However, a full hour's search (looking, in particular, for the official specification, but secondarily searching for any such documentation for either SQL, MySQL, or SQLYog) has revealed literally only one link that even makes reference to the fact that commented lines of code in the SQL script are, in fact, executed. Here it is: link to reference that commented lines of SQL are executed (including some of the answers).
I'm aware that I am likely missing the obvious here, but I haven't been able to locate the specification for this.
Can someone please confirm, and if so please provide reference to, the formal documentation that states (and describes) the SQL that will be executed even if the '/* */
' syntax surrounds the statement/s (whether this be SQL, MySQL, or SQLYog)? Thanks.
It's in the manual, under "Comment Syntax."
http://dev.mysql.com/doc/refman/5.6/en/comments.html
...
In the case of stored procedures, the entire declaration wrapped, so that if you tried to restore the dump file on a version of MySQL server that's so old it didn't support stored procedures at all, the procedure definitions would be ignored by the server instead of causing the entire restore operation to fail.