mrjgreen/db-sync

SQL Error with v3.2.0

danielfaulknor opened this issue · 5 comments

With MySQL 5.7

[notice] Dry run only. No data will be written to target.
[info] Hash calculation:

CONCAT(COALESCE(LOWER(CONV(BIT_XOR(CAST(CONV(SUBSTR(MD5(CONCAT_WS('#', `id`, `date`, `time`, `ip`, `urlrequested`, `agent`, `referrer`, `search`, `os`, `browser`, `searchengine`, `spider`, `feed`, `user`, `timestamp`, `language`, `country`, `realpost`, `post_title`)),17,16),16,10) AS UNSIGNED)), 10, 16)), 0),COALESCE(LOWER(CONV(BIT_XOR(CAST(CONV(SUBSTR(MD5(CONCAT_WS('#', `id`, `date`, `time`, `ip`, `urlrequested`, `agent`, `referrer`, `search`, `os`, `browser`, `searchengine`, `spider`, `feed`, `user`, `timestamp`, `language`, `country`, `realpost`, `post_title`)),1,16),16,10) AS UNSIGNED)), 10, 16)), 0))
SQLSTATE[42000]: Syntax error or access violation: 1064 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 ') < ()) t limit 1' at line 1

Sorry to hear you are having problems - could you post your table schema?

Thanks for your response! Here is the schema :)

CREATE TABLE `wp_statpress` (
  `id` mediumint(9) UNSIGNED NOT NULL,
  `date` int(8) UNSIGNED NOT NULL,
  `time` char(8) DEFAULT NULL,
  `ip` varchar(39) DEFAULT NULL,
  `urlrequested` text,
  `agent` text,
  `referrer` text,
  `search` text,
  `os` tinytext,
  `browser` tinytext,
  `searchengine` tinytext,
  `spider` tinytext,
  `feed` tinytext,
  `user` tinytext,
  `timestamp` int(10) UNSIGNED NOT NULL,
  `language` varchar(3) DEFAULT NULL,
  `country` varchar(3) DEFAULT NULL,
  `realpost` tinyint(1) DEFAULT NULL,
  `post_title` tinytext
) ENGINE=InnoDB;

--
-- Indexes for table `wp_statpress`
--
ALTER TABLE `wp_statpress`
  ADD PRIMARY KEY (`id`),
  ADD KEY `date` (`date`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `wp_statpress`
--
ALTER TABLE `wp_statpress`
  MODIFY `id` mediumint(9) UNSIGNED NOT NULL AUTO_INCREMENT;

Thats great, could you also show me the db sync command you are running?

Does the schema on the remote table match the source table exactly? Indexes too?

aha! The primary key index was missing from the target table. Thanks!!

Great, I'm glad we got to the bottom of it! I'll add some test cases for this, and try to throw a more explicit error.

Thanks for the feedback :)