changes sql to pg