I think the problem is SQLite3.
If we look to the query it has some ambiguety because it is
aliasing SUM(salary) to salary but the table has a salary column
too. In MySQL it even outputs this message:
1052 Column 'salary' in group statement is ambiguous
Output doing the query from the sqlite console:
sqlite> SELECT SUM(salary) AS salary FROM developers GROUP BY salary HAVING SUM(salary) > 10000;
SQL error: aggregate functions are not allowed in the GROUP BY clause
Output doing the query but qualifying the field in the GROUP BY
clause:
sqlite> SELECT SUM(salary) AS salary FROM developers GROUP BY developers.salary HAVING SUM(salary) > 10000;
80000
800000
150000
I think there was a change from 3.4.2 (used in
ci.rubyonrails.org) to 3.6.12 (my version) where the default
qualification now locks to SUM(salary) when before it locked to
developers.salary