Flag dottie raw query

Fixes issue #2061 and also #1837. Also contains pull request #2062 as I'm not sure how to separate the two.