CRM-21121 - Fix crash with sql_mode is only_full_group_by #10926
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The Event Income Summary report crashes if your sql_mode is only_full_group_by (which is default on MySQL 5.7.5+)
Before
Crash (see JIRA for backtrace)
After
No crash.
Technical Details
I was concerned about simply grouping by the currency - but then I saw that events don't support multiple currencies (though this report DOES support multiple currencies, just not on the same event).
If that were to change in the future, this SQL statement would need to change anyway, so I believe this is safe.
Comments
A tester should ideally have MySQL 5.7.5+ (Ubuntu 16.04+ has it). Testing is relatively simple, because the SQL generated is pretty straightforward.