Use MySQL column names in MySQL queries.

The query for concurrency-support didn't get the memo that we should ignore
PostgreSQL identifier-case when querying the source MySQL database. Fix the
query string to include column names as given by the MySQL catalogs.

In bug report #703, the problem is found in PostgreSQL queries. This has
been fixed before already. Trying to reproduce the bug produced an error in
the concurrency-support query instead, so let's fix this one.

Fix #703.
This commit is contained in:
Dimitri Fontaine 2017-12-22 14:15:46 +01:00
parent 25c79dfebc
commit 07cdf3e7e5
3 changed files with 12 additions and 2 deletions

View File

@ -54,7 +54,9 @@
;; the table has a primary key over a integer data type we are able
;; to generate WHERE clause and range index scans.
(with-connection (*connection* (source-db mysql))
(let* ((col pcol)
(let* ((col (mysql-column-name
(nth (position coldef (table-column-list (target mysql)))
(fields mysql))))
(sql (format nil "select min(`~a`), max(`~a`) from `~a`"
col col (table-source-name (source mysql)))))
(destructuring-bind (min max)

View File

@ -5,7 +5,8 @@ load database
WITH concurrency = 2,
multiple readers per thread,
rows per range = 50000
rows per range = 50000,
quote identifiers
ALTER SCHEMA 'pgloader' RENAME TO 'mysql'

7
test/mysql/my.sql vendored
View File

@ -100,6 +100,13 @@ create table bits
insert into bits(bool) values(0b00), (0b01);
/*
* https://github.com/dimitri/pgloader/issues/703
*/
create table `CamelCase` (
`validSizes` varchar(12)
);
CREATE TABLE `fcm_batches` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`raw_payload` mediumtext COLLATE utf8_unicode_ci,