editing sql for pg