Fix type conversion when retrieving origins' urls from PostgreSQL backend
Correct some SQL code capitalization as well.