LPS-31833 bug in custom sql