switch from sql to postgresql