change in db query for pg