swh-func.sql: use LANGUAGE sql wherever possible
Overall, we can use LANGUAGE sql only in 6 cases (vs 17 functions that
remains plpgsql). This is in large part due to the fact that LANGUAGE
sql stored procedures cannot non-existent tables, and most notably
temporary tables.
Closes T55.