Filtering roadmap by milestone returns "Something went wrong while fetching epics"

Summary

When viewing the roadmap for a group, attempting to filter using "milestone" shows the error "Something went wrong while fetching epics" and no data is returned.

When looking at the network log in the browser tools, there is a GraphQL request to roadmapGroupEpics returning a 500 error. Taking a look at Kibana, I was able to find the error-ing request in the logs, and it looks like there's a PostgreSQL error at the root of it:

PG::AmbiguousColumn: ERROR:  column reference "start_date" is ambiguous
LINE 1: ...SE OR "epics"."confidential" = TRUE AND 1=0) AND (start_date...

Steps to reproduce

  • Pick any group that has epics in use. GitLab.org is one I was able to replicate with!
  • In the sidebar go to Epics > Roadmap and see some data is loaded.
  • When viewing the roadmap, click in the filter / search box and select "Milestone = " and pick any milestone to filter on, I just picked 15.3 since I know that should be an active one for the GitLab group.
  • See a red banner with "Something went wrong while fetching epics", and in the network tools in the browser you can see the GraphQL request has a 500.

Example Project

I didn't make a custom project since I could replicate in any project with epics, it doesn't seem to require any specific setup.

What is the current bug behavior?

Filtering by milestone returns an error instead of actual data.

What is the expected correct behavior?

Epics in the roadmap can be filtered by milestone, much like you can filter by label or author (and those seem to work okay currently).

Relevant logs and/or screenshots

Here's a picture of the error itself:

GitLab.org group showing error when searching by milestone

This is a link to the Kibana log line for my replication showing the PostgreSQL error (accessible for GitLab team members):

https://log.gprd.gitlab.net/app/discover#/doc/7092c4e2-4eb5-46f2-8305-a7da2edad090/pubsub-rails-inf-gprd-012644?id=xqRIk4IBExTeCTjeEOao

Output of checks

This bug happens on GitLab.com (hence I also removed the next two sections about application / environment checks).

Possible fixes

Looks like it's something in the way we're doing the SQL join, so I'd guess we have to alter that to not have two things with the same column name.