Unable to get correct total on query with GROUP BY
Opened this issue · 3 comments
Create a custom query with GROUP BY clause, it will return false number as total
As the current SQL query to get the total number of row is by using a count statement in SQL select, if we are using GROUP BY in our SQL it will return the count in the grouped rows instead of total row count. My workaround solution is by extending the _find function and adding _clearGrouping('group');
in the query for getting count numbers.
Expected behavior
Return count of total row not the count of grouped row.
Actual behavior
It return count of grouped row.
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working): feathers-knex 5.0.4, knex 0.16.3
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Apologies if the issue could not be resolved. FeathersJS ecosystem modules are community maintained so there may be a chance that there isn't anybody available to address the issue at the moment. For other ways to get help see here.
@daffl Are there any plans on fixing this bug anytime soon? If not, are you okay with me making a pull request to fix this? It would be nice to not have to override this service in order to get the correct total. I feel like this should be a fairly easy fix too (I think it's just a matter of adding a clearGroup call when initializing the countQuery variable).
A pull request with a test and fix is always welcome.