Updating the queries for postgres.