[Toolserver-l] MySQL-CLI and comments

Ja Ga jaga_x_1 at yahoo.com
Tue Aug 23 17:32:27 UTC 2011


Is this problem with comments outside queries in a SQL file exclusive to /* Comment */ style comments, or are

#
# Comment
#

style comments a problem as well?

Thanks,
Jason

--- On Tue, 8/23/11, toolserver-l-request at lists.wikimedia.org <toolserver-l-request at lists.wikimedia.org> wrote:

the following message is only interesting for people who uses the MySQL-CLI 
(the "mysql"-command on the command-line) or the "sql"-script. It doesn't 
matter if you use php, perl, phyton, java or other languages.

The problem is that the mysql-cli strips out comments by default (see 
bugreport [1]). That is bad for us, because it strips all SLOW_OK or LIMIT: 
too; so if you add a SLOW_OK at the mysql-cli it will stript out and the 
query-killer will kill it sooner. To prevent this, I changed the mysql-config 
in a way that comments will NOT be stripted yesterday [2] .

In the last hour a user told me, that this has a problematic side-effect: if 
you use /* foobar */ in a mysql-file OUTSIDE of a query, the file will fail; the 
user was angry because I changed the default without telling.

I still think that the mysql-default (to strip comments) is stupid (because in 
my eyes the user doesn't expect that comments he/she inserts will be removed).

So here is my plan: I will revert my changes for now (so the mysql-cli will 
strip comments again). And I hereby announce that I'm going to change the 
default at wednesday, the  31. August, in a way that comments will NOT the 
striped out.

You what that means for you:
-If you don't use comments at the mysql-cli: nothing.
-If you use comments at the mysql-cli: You have to add the following lines to 
,your .my.cnf-file (you can find this hidden file in your home ? please notice 
the "." at the start):

--snip--
[mysql]
comments
--snap--

-If you need the default of the mysql-cli after the 31. August, you have to 
add the following lines to your .my.cnf:

--snip--
[mysql]
skip-comments
--snap--

My revert will not affect the "sql"-script (our recommend way to uise myql on 
the command-line): It will still not strip the comments.

Please feel free to discuss this and ask for details on the mailinglist.

Sincerly,
DaB.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wikimedia.org/pipermail/toolserver-l/attachments/20110823/b85ceb8b/attachment.htm 


More information about the Toolserver-l mailing list