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

Fix duplicate teams+experiences in user list api #7646

Merged
merged 3 commits into from
Feb 22, 2024
Merged

Conversation

fm3
Copy link
Member

@fm3 fm3 commented Feb 22, 2024

Our query suffered from Left Join Fanout effect, leading to duplicates. This is resolved by using subqueries with WITH, as described here.
Also, an inner join with user_team_roles would lead to users being omitted altogether in case they have no team memberships.
Also, the users_ view should be used for the join, in order to skip deleted users. Unfortunately, using the view means all selected fields need to occur in the GROUP BY clause (that shortcut is not available for views)

URL of deployed dev instance (used for testing):

Steps to test:

  • Assign multiple experiences and team roles to a user
  • /api/users should include their teams and experiences only once each.

Issues:


@fm3 fm3 merged commit c1adede into master Feb 22, 2024
2 checks passed
@fm3 fm3 deleted the fix-user-list-duplicates branch February 22, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL Errors (Duplicate Key) on Experience domain edits
2 participants