Fixed PG sql syntax