Postgresql Function Select Count Into Variable