Fix illegal use of cursors against IN query.