Fixed #18414 -- Raise assertion with exists() and sliced query

Assertion that query hasn't been sliced when calling exists() method.