PR: return proper result code for delete by query api

PR for #2963