I've hit a brick wall related to #2941499: Duplicate nodes when using Views relationships and #2799479: Views doesn't recognize relationship to host. I've got a view that does a join to a Paragraph using Entity Reference Revision that's adding an errant paragraph id field to the sql query results. In theory, I'm filtering on this paragraph, but I don't want to display any of the paragraph's data.
This paragraph id field isn't displayed, nor is it queried against. But it's completely screwing up the distinct query. I can only get rid of duplicate results using aggregation, which is killing performance.
What I'd like to do is remove a specific field from the SELECT DISTINCT query. I've tested this manually and the query works perfectly. But the field isn't in with $query->fields. I think it's automagically getting added by Entity Reference Revisions.
Is it possible to remove a field like this using a hook_views_query_alter? Or is this an Entity Reference Revisions issue?