Fix sqlite to postgresql