Postgresql Function Store Select Into Sql Syntax Error