mysql> set global sql_mode="ONLY_FULL_GROUP_BY";
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
~$ ./pt-table-checksum -h 127.0.0.1 --port=21178
TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE
06-30T11:07:41 0 0 9 1 0 0.256 employees.departments
06-30T11:07:44 Error executing EXPLAIN SELECT COUNT(*), '0' FROM `employees`.`dept_emp` FORCE INDEX(`PRIMARY`) WHERE ((`emp_no` < ?) OR (`emp_no` = ? AND `dept_no` < ?)) ORDER BY `emp_no`, `dept_no` /*explain past lower chunk*/: DBD::mysql::st execute failed: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause [for Statement "EXPLAIN SELECT COUNT(*), '0' FROM `employees`.`dept_emp` FORCE INDEX(`PRIMARY`) WHERE ((`emp_no` < ?) OR (`emp_no` = ? AND `dept_no` < ?)) ORDER BY `emp_no`, `dept_no` /*explain past lower chunk*/" with ParamValues: 0='10001', 1='10001', 2='d005'] at ./pt-table-checksum line 7866.
06-30T11:07:44 Skipping chunk 11 of employees.dept_emp because MySQL chose no index instead of the PRIMARYindex.
06-30T11:07:44 Error executing EXPLAIN SELECT COUNT(*), '0' FROM `employees`.`dept_emp` FORCE INDEX(`PRIMARY`) WHERE ((`emp_no` > ?) OR (`emp_no` = ? AND `dept_no` > ?)) ORDER BY `emp_no`, `dept_no` /*explain past upper chunk*/: DBD::mysql::st execute failed: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause [for Statement "EXPLAIN SELECT COUNT(*), '0' FROM `employees`.`dept_emp` FORCE INDEX(`PRIMARY`) WHERE ((`emp_no` > ?) OR (`emp_no` = ? AND `dept_no` > ?)) ORDER BY `emp_no`, `dept_no` /*explain past upper chunk*/" with ParamValues: 0='499999', 1='499999', 2='d004'] at ./pt-table-checksum line 7866.
06-30T11:07:44 2 0 331603 12 2 2.685 employees.dept_emp
06-30T11:07:44 0 0 24 1 0 0.289 employees.dept_manager
06-30T11:07:45 Error executing EXPLAIN SELECT COUNT(*), '0' FROM `employees`.`employees` FORCE INDEX(`PRIMARY`) WHERE ((`emp_no` < ?)) ORDER BY `emp_no` /*explain past lower chunk*/: DBD::mysql::st execute failed: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause [for Statement "EXPLAIN SELECT COUNT(*), '0' FROM `employees`.`employees` FORCE INDEX(`PRIMARY`) WHERE ((`emp_no` < ?)) ORDER BY `emp_no` /*explain past lower chunk*/" with ParamValues: 0='10001'] at ./pt-table-checksum line 7866.
06-30T11:07:45 Skipping chunk 3 of employees.employees because MySQL chose no index instead of the PRIMARYindex.
06-30T11:07:45 Error executing EXPLAIN SELECT COUNT(*), '0' FROM `employees`.`employees` FORCE INDEX(`PRIMARY`) WHERE ((`emp_no` > ?)) ORDER BY `emp_no` /*explain past upper chunk*/: DBD::mysql::st execute failed: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause [for Statement "EXPLAIN SELECT COUNT(*), '0' FROM `employees`.`employees` FORCE INDEX(`PRIMARY`) WHERE ((`emp_no` > ?)) ORDER BY `emp_no` /*explain past upper chunk*/" with ParamValues: 0='499999'] at ./pt-table-checksum line 7866.
I hit a similar bug. This is also a bug in mysql documentation - http:// dev.mysql. com/doc/ refman/ 5.6/en/ server- sql-mode. html#sqlmode_ only_full_ group_by - since according to that implicit group by is not covered under ONLY_FULL_GROUP_BY.
In fact, two different error codes are used for same sql_mode - ER_WRONG_ FIELD_WITH_ GROUP (which is what I should be) and ER_MIX_ OF_GROUP_ FUNC_AND_ FIELDS. Furthermore, former error validates that the field is actually a real field (v/s a string/int/real field like '0' or 1) whereas the later doesn't do that check --
if (thd->variables .sql_mode & MODE_ONLY_ FULL_GROUP_ BY && !group_list && lex->non_ agg_field_ used() && lex->agg_ func_used( ))
select_
select_
non_agg_ field_used( ) ideally shouldn't be true for fields which are not Item::FIELD_ITEM.
I will file a bug with bugs.mysql regarding this.