Create SQL functions and views in right schema (fixes #1343)