Test database for recreating mysqldbimport error

Here is a zip file containing a MySQL dump file for a database consisting of one table with two columns (ID, foovaluefoo) and one row of data (contents of the dump file shown below).  I added CREATE and USE statements for a schema named ‘test’.

Importing this sql file with the Workbench 6.3 msqldbimport shell utility will cause the following error when executing the INSERT statement:

ERROR: Invalid statement:
INSERT INTO `some_table` (`ID`, `foo VALUES foo`)
ERROR: Query failed. 1064 (42000): You have an error in your SQL syntax; check t
he manual that corresponds to your MySQL server version for the right syntax to
use near '' at line 1

In general, if the substring ‘value’ appears as a fragment of a column name in any table, mysqldbimport will corrupt the column name by inserting the prettified keyword ‘ VALUES ‘ before executing the INSERT, thereby causing the INSERT to fail.  I’m not sure if this behavior is limited to the string ‘value’ or if mysqldbimport may also be corrupting other keyword-esque column names.

 

-- MySQL dump 10.13  Distrib 5.7.17, for Win64 (x86_64)
---- Host: 127.0.0.1    Database: test-- 
------------------------------------------------------
-- Server version 5.7.19-log

/*!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 */;/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

CREATE DATABASE IF NOT EXISTS test DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE test;

--
-- Table structure for table `some_table`
--

DROP TABLE IF EXISTS `some_table`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `some_table` (
  `ID` int(11) NOT NULL,
  `foovaluefoo` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `some_table`
--

LOCK TABLES `some_table` WRITE;
/*!40000 ALTER TABLE `some_table` DISABLE KEYS */;
INSERT INTO `some_table` (`ID`, `foovaluefoo`) VALUES (1,'yadda');
/*!40000 ALTER TABLE `some_table` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2017-09-17 12:23:04
Updated: September 18, 2017 — 8:49 am

The Author

Don Alejandro

Don is a renegade physicist who manages website software for several local groups from an undisclosed location in the woods of West Virginia...

Leave a Reply

Your email address will not be published. Required fields are marked *

Send this to a friend