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

CRM-21789: 'Find Case' group by issue #11706

Merged
merged 2 commits into from
Feb 22, 2018
Merged

Conversation

monishdeb
Copy link
Member

@monishdeb monishdeb commented Feb 22, 2018

Overview

Steps to replicate:

  1. Ensure that MySQL FULL_GROUP_BY_MODE is enabled
  2. Empty submit the criteria of 'Find Cases'

Before

The actual number of rows listed and the row count per page differs. In the screencast below, only 2 rows are listed despite having 10 counts per page:
test-multiple-before

After

The actual number of rows listed and the row count per page is equal now. In the screencast below, 10 rows are listed as per 10 counts per page:
test-multiple-after


@monishdeb
Copy link
Member Author

@lcdservices
Copy link
Contributor

This fixes the issue. Find case search now returns the correct number of results based on the count and pagination setting (number of records to list).

@colemanw
Copy link
Member

@colemanw colemanw merged commit 29714b6 into civicrm:master Feb 22, 2018
@eileenmcnaughton
Copy link
Contributor

So this means we are using GROUP_CONCAT rather than ANY_VALUE in the second query? My first thought looking was no no no ANY_VALUE is a hack - but I think you may be reducing the hack usage?

I am still concerned though that we are only fixing the query for mysql configs that report the query. To be clear - a query with group by is incorrect if it has fields that are in the select but not in the group by or the aggregate. Using ANY_VALUE is effectively like 'ignore this code error because we haven't managed to fix it properly or just possibly there is a real excuse for it'. Using GROUP_CONCAT is a real fix - because we know all values are returned. We shouldn't only offer the real fix for sites with mysql 5.7 or FULL GROUP BY - that's a bit like saying 'lets' fix all the e-notice identified bugs for the sites that have e-notice reporting enabled'.

I think we should be working towards dropping the if here CRM_Utils_SQL::disableFullGroupByMode()
to give the same queries in all cases. (that doesn't need to be this round but it should be our understood goal)

@monishdeb monishdeb deleted the CRM-21789 branch February 23, 2018 03:42
@monishdeb
Copy link
Member Author

monishdeb commented Feb 23, 2018

@colemanw thank you for merging this PR :)

@eileenmcnaughton yes I am using GROUP_CONCAT in this case. Also from our last discussion I had in mind to create a separate JIRA ticket and there will be a lot of changes in this direction and might take some time fix em all. So here's the ticket - https://issues.civicrm.org/jira/browse/CRM-21794

This is one of the priority issue for NYSS so I didn't feel that it would be appropriate to include the improvements as part of this PR.

@mlutfy mlutfy added this to the 4.7.32 milestone Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants