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

Update for compatibility with MySQL 5.7+ #744

Closed
wants to merge 1 commit into from
Closed

Update for compatibility with MySQL 5.7+ #744

wants to merge 1 commit into from

Conversation

lmgonzales
Copy link
Contributor

getUniqueResources, getUniqueTags, and getUniqueUsers was failing due to mySQL5.7 compatibility issues. The error being thrown by mySQL was: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

To fix, we have to specifically select the columns that are used instead of selecting *.

See: https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html for more info.

getUniqueResources, getUniqueTags, and getUniqueUsers was failing due to mySQL5.7 compatibility issues. The error being thrown by mySQL was: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

To fix, we have to either turn off the only_full_group_by option or specifically select the columns that are used instead of selecting *.

See: https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html for more info.
@demiankatz
Copy link
Member

demiankatz commented Jul 5, 2016

Thanks for this! I've committed it with some changes as ec63614 -- as it turns out, the initial solution from this PR doesn't work with PostgreSQL because the ANY_VALUE function is MySQL-specific. I replaced ANY_VALUE with MAX, which should have the same effect while being a bit more universally compatible (at the price of, probably, slightly worse performance). Additionally, there were some order-related problems that were breaking this functionality in PostgreSQL, so I went ahead and fixed those at the same time.

Thanks again for improving VuFind's database compatibility! Hopefully this will reduce problems for many users going forward.

@demiankatz demiankatz closed this Jul 5, 2016
@lmgonzales
Copy link
Contributor Author

Thanks for updating the PR so that it works with PostgreSQL, and getting it merged into master. I appreciate the help with the code!

mbeh-ub added a commit to mbeh-ub/vufind that referenced this pull request Dec 16, 2016
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

Successfully merging this pull request may close these issues.

2 participants