switched sql for pg