Fixed #14334 -- Query comparision now check for object types.

The reason I have not done that because this way the logic of why no error should be raised is more clear.
If I do it the other way, I think it will not be that clear.
Do you still think I should do it?