Postgres Function Select Into Sql