Fix sql validation