SELECT
  permission_name,
  reltype
FROM user_permission_groups upg
  JOIN permissions_permission_groups ppg ON ppg.permission_group_name = upg.permission_group_name
WHERE upg.user_id = $(userId)
;