Bug #5304
closed[API] filters incorrectly exclude results for records with null value in filtered field
Description
There appears to be a bug in our filter code on the API side, where a call like this:
arv group list --filters='[["group_class", "!=", "project"]]'
does not return any groups where group_class is set to null. Of course group_class should probably not be set to null, but that is irrelevant; the filter should not exclude those records from this call.
The workbench code uses a functionally identical API call to show the list of groups on the sharing screen.
Updated by Brett Smith almost 10 years ago
- Category set to API
I note this code in record_filters.rb:
if operator == 'not in' and not operand.include?(nil)
# explicitly allow NULL
cond_out[-1] = "(#{cond_out[-1]} OR #{ar_table_name}.#{attr} IS NULL)"
end
This makes me think we need similar logic for equality operators.
Updated by Tom Clegg almost 10 years ago
Agreed. The SQL way of thinking (NULL == 1 is false, and NULL <> 1 is also false) seems confusing enough to be worth explicitly breaking away from.
Updated by Radhika Chippada almost 10 years ago
- Status changed from New to In Progress
- Assigned To set to Radhika Chippada
- Target version changed from Bug Triage to 2015-03-11 sprint
Updated by Brett Smith almost 10 years ago
Commit:c68037a looks great. Go ahead and merge. Thanks.
Updated by Radhika Chippada almost 10 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Applied in changeset arvados|commit:83c0e051c3611b021d7f0e2ea58d10c67c92698d.