This week I learned about PostgreSQL’s conditional expressions in
general and the COALESCE expression in particular. A big part of the
grungingess of my Discogs Postgres views is dealing with the
data’s usage of alternative name variations
or anvs
in the
fabric_track_artists
view which are
quite often NULL. This propagates into a crappy ad hoc value for the
track_artists
via abuse of concat_ws
. I’ve got a pretty good
feeling that can be handled more elegantly with a COALESCE.
A couple of other things that need investigating:
- The regexps for fabric vs fabriclive should be collapsed into one
- Rename the
fabric_live
column to a more generalfabric_series
and compute it from thetitle
column - Reexamine the UNION statements to see if they can be handled by a more appropriate join
Lots of redundancy that can be cleaned up.