diff --git a/src/sources/mysql/mysql.lisp b/src/sources/mysql/mysql.lisp index 72a8cf1..34e5caf 100644 --- a/src/sources/mysql/mysql.lisp +++ b/src/sources/mysql/mysql.lisp @@ -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) diff --git a/test/mysql/my.load b/test/mysql/my.load index fc82232..1bc17d9 100644 --- a/test/mysql/my.load +++ b/test/mysql/my.load @@ -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' diff --git a/test/mysql/my.sql b/test/mysql/my.sql index 44234f1..17cd3b6 100644 --- a/test/mysql/my.sql +++ b/test/mysql/my.sql @@ -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,