Test "NOT IN" queries

Fixes #1182 and #1171. @alazier ?