Bug #5300 mysqldump "comments" generate empty statements (broken) in older versions
Submitted: 30 Aug 2004 20:32 Modified: 30 Aug 2004 20:48
Reporter: Timothy Smith Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:4.1 OS:Any (any)
Assigned to: CPU Architecture:Any

[30 Aug 2004 20:32] Timothy Smith
Description:
mysqldump uses comments to hide SET commands from older versions.  But it has to put the ';' outside the comment for the statement to be seen.  Well, in older versions, that leaves just a plain ';', which gives an error because it is an empty statement.

This doesn't give an error in 4.0.20 or 3.23.58; however, in older versions just a comment was not considered a valid statement.

How to repeat:
Try running the following dump on an old mysql server.

tim@sand:m/41/m$ mysqldump test t
-- MySQL dump 10.7
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version       4.1.4-beta-debug

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;

--
-- Table structure for table `t`
--

DROP TABLE IF EXISTS `t`;
CREATE TABLE `t` (
  `a/b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `t`
--

/*!40000 ALTER TABLE `t` DISABLE KEYS */;
LOCK TABLES `t` WRITE;
UNLOCK TABLES;
/*!40000 ALTER TABLE `t` ENABLE KEYS */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Suggested fix:
use this instead:

SET @DUMMY=1 /*!40101 , @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
SET @DUMMY=1 /*!40101 , @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

It will make things more compatible with older MySQL versions.
[30 Aug 2004 20:48] Brian Aker
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php