Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats.jsp uses slightly incorrect SQL query with nonaggregated column. It's not compatible with default MySQL settings anymore. #2

Open
Nable80 opened this issue Jul 17, 2018 · 0 comments

Comments

@Nable80
Copy link

Nable80 commented Jul 17, 2018

MySQL 5.5 was more permissive but 5.7 has finally uncovered this problem.

E.g.:

select nick, user_id, reg, COUNT(*) cnt from x_mipt_cc_messages
where msgDate BETWEEN (NOW() - INTERVAL 1 DAY) AND NOW()
group by nick
order by cnt desc;
-- ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause
-- and contains nonaggregated column 'xonix_search.x_mipt_cc_messages.user_id'
-- which is not functionally dependent on columns in GROUP BY clause;
-- this is incompatible with sql_mode=only_full_group_by

There is a dirty workaround but I don't want it to become a permanent solution:

[mysqld]
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant