Skip to content

Commit

Permalink
Fix release groups aggregate for artists without any release groups
Browse files Browse the repository at this point in the history
If the artist has no release groups, the left join to release_group_data
will cause a NULL row to be added to the array, filter ensures that it is
removed.
  • Loading branch information
amCap1712 committed Dec 27, 2023
1 parent 0bf4f44 commit f8f2c69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mbid_mapping/mapping/mb_artist_metadata_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ def get_metadata_cache_query(self, with_values=False):
rgd.caa_id,
rgd.caa_release_mbid
) ORDER BY rgd.date
) AS release_groups
)
-- if the artist has no release groups, left join will cause a NULL row to be
-- added to the array, filter ensures that it is removed
FILTER (WHERE rgd.release_group_mbid IS NOT NULL) AS release_groups
FROM musicbrainz.artist a
LEFT JOIN musicbrainz.artist_type at
ON a.type = at.id
Expand Down

0 comments on commit f8f2c69

Please sign in to comment.