Fixes #1501 stackoverflow by and predicate
Merged conficts
Merge pull request #1516 from pveentjer/fix/3.maintenance/andresultset-stackoverflow

Fix/3.maintenance/andresultset stackoverflow