Fix sql validations