2

We have a client that has had their servers for soo long, they were still running MySQL 4.0.24.
Now that they are refreshing their servers, we took a mysqldump of their current database to put into the new servers and are getting errors like:

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 'call' 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 'call
(
path varchar(255) NOT NULL default '',
call_num int(12) unsigned ' at line 1

The section of the dump file it is complaining about is:

--
-- Table structure for table `call`
--

DROP TABLE IF EXISTS call;
CREATE TABLE call (
  path varchar(255) NOT NULL default '',
  call_num int(12) unsigned NOT NULL auto_increment,
  date datetime NOT NULL default '0000-00-00 00:00:00',
  idf varchar(4) NOT NULL default '404',
  location varchar(255) default NULL,
  who_req varchar(8) default NULL,
  who_res varchar(8) default NULL,
  PRIMARY KEY  (path,call_num)
) ENGINE=MyISAM;

--
-- Dumping data for table `call`
--

So, does anyone have any ideas on this one?

closed as off-topic by Paul White, Philᵀᴹ, Max Vernon, Colin 't Hart, dezso May 8 '15 at 9:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Paul White, Philᵀᴹ, Max Vernon, Colin 't Hart, dezso
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    CALL is a reserved keyword, since version 5.0 – ypercubeᵀᴹ Apr 25 '15 at 1:36
  • OMG 4.0, you poor thing !!! – RolandoMySQLDBA May 7 '15 at 19:06
2

Well,

I figured out that if you use the backticks ("`") around the table name (like mysqldump uses in the comment-separator sections, e.g. `call`), it works as expected.

So, the above should look like:

--
-- Table structure for table `call`
--

DROP TABLE IF EXISTS `call`;
CREATE TABLE `call` (
  path varchar(255) NOT NULL default '',
  call_num int(12) unsigned NOT NULL auto_increment,
  date datetime NOT NULL default '0000-00-00 00:00:00',
  idf varchar(4) NOT NULL default '404',
  location varchar(255) default NULL,
  who_req varchar(8) default NULL,
  who_res varchar(8) default NULL,
  PRIMARY KEY  (path,call_num)
) ENGINE=MyISAM;

--
-- Dumping data for table `call`
--

Hope that helps.

Not the answer you're looking for? Browse other questions tagged or ask your own question.