[#3349] Prevent race condition in profile view creation.
The only reliable way to prevent it is a condition on the database. In postgres, we add a unique constraint on views with type = 'profile'. MySQL doesn't support this, so we do nothing. (cherry picked from commit ac7b45c3) Conflicts: htdocs/lib/db/upgrade.php htdocs/lib/upgrade.php