CREATE OR REPLACE FUNCTION update_artist_name (old_artist_name TEXT, new_artist_name TEXT) RETURNS void AS $$
BEGIN
  UPDATE listens
  SET artist_name = new_artist_name
  WHERE artist_name = old_artist_name;
  UPDATE albums
  SET artist_name = new_artist_name
  WHERE artist_name = old_artist_name;
END;
$$ LANGUAGE plpgsql;
