Group MR search: Specific search results in 500 (PG::GroupingError) dependant on ordering preference of user
Summary
Searching for things with no approver
(or approved by
) and with some text results in an instant 500 when the user's ordering preference is either: Title
, Created At
or Updated Date
. Work around is to avoid these ordering preferences for Group MR searches.
Steps to reproduce
-
Check your current ordering setting by going here: https://gitlab.com/gitlab-com/www-gitlab-com/-/merge_requests?author_username=phikai&scope=all&sort=title_asc&state=opened To change your current setting, perform a search here (it will succeed)
-
Change your ordering preference to either
Title
,Created At
orUpdated Date
-
Go to - https://gitlab.com/groups/gitlab-com/-/merge_requests?scope=all&state=opened&approved_by_usernames[]=None&search=test or https://gitlab.com/groups/gitlab-com/runner-maintainers/-/merge_requests?scope=all&state=opened&approver_usernames[]=None&search=test
-
Observe 500
Example Project
Not needed
What is the current bug behavior?
Results in a 500:
PG::GroupingError: ERROR: column "merge_requests.target_branch" must appear in the GROUP BY clause or be used in an aggregate function
What is the expected correct behavior?
Search properly works
Relevant logs and/or screenshots
Correlation ID: 01GK6MRNR5CB1KSG3V6M33T3Y5
Kibana: https://log.gprd.gitlab.net/goto/f7a19c80-7166-11ed-85ed-e7557b0a598c
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)