Skip to content

Commit

Permalink
fix mysql < 5.7.5 with only_full_group_by
Browse files Browse the repository at this point in the history
From MySQL's docs, versions less than 5.7.5 support SQL-92's version of
GROUP BY, which requires all non-aggregate columns to show up in the
GROUP BY.

> SQL:1999 and later permits such nonaggregates per optional feature T301
> if they are functionally dependent on GROUP BY columns: If such
> a relationship exists between name and custid, the query is legal. This
> would be the case, for example, were custid a primary key of customers.
> MySQL 5.7.5 and later implements detection of functional dependence.
> https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

Turns out Travis hasn't been testing on 5.6, which explains why it was
working (to my bewilderment, as I know this is an issue).

Thanks @augensalat for reporting this issue!

Fixes #36
  • Loading branch information
preaction committed Jun 18, 2021
1 parent ebd901d commit 5625b71
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -28,7 +28,6 @@ matrix:
env: MYSQL_VERSION=5.7 MYSQL_STRICT=1
- perl: "5.28"
env: MYSQL_VERSION=5.6 MYSQL_STRICT=1
dist: trusty
- perl: "5.28"
env: MYSQL_VERSION=8.0 MYSQL_UTF8MB4=1
- perl: "5.28"
Expand All @@ -47,7 +46,7 @@ before_install:
. /etc/lsb-release;
sudo add-apt-repository "deb http://repo.mysql.com/apt/ubuntu/ $DISTRIB_CODENAME mysql-$MYSQL_VERSION";
sudo apt-get update;
sudo DEBIAN_FRONTEND=noninteractive apt-get -q --yes --fix-broken --allow-unauthenticated --option DPkg::Options::=--force-confnew install mysql-server;
sudo DEBIAN_FRONTEND=noninteractive apt-get -q -t mysql-$MYSQL_VERSION --yes --fix-broken --allow-unauthenticated --option DPkg::Options::=--force-confnew install mysql-server;
echo "upgrading mysql";
sudo mysql_upgrade -u root --password='' --force;
sudo service mysql restart;
Expand Down
2 changes: 1 addition & 1 deletion lib/Minion/Backend/mysql.pm
Expand Up @@ -603,7 +603,7 @@ sub _try {
AND job.queue IN ($qq) AND job.task IN ($qt)
$sql_job_id
AND (job.expires IS NULL OR job.expires > NOW())
GROUP BY job.id
GROUP BY job.id, job.args, job.retries, job.task
HAVING SUM(
parent.state IS NOT NULL AND (
parent.state = 'active'
Expand Down

0 comments on commit 5625b71

Please sign in to comment.