Bug #5304
closed
[API] filters incorrectly exclude results for records with null value in filtered field
Added by Ward Vandewege about 9 years ago.
Updated about 9 years ago.
Assigned To:
Radhika Chippada
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.
- Description updated (diff)
- Description updated (diff)
- Description updated (diff)
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.
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.
- Status changed from New to In Progress
- Assigned To set to Radhika Chippada
- Target version changed from Bug Triage to 2015-03-11 sprint
Commit:c68037a looks great. Go ahead and merge. Thanks.
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Applied in changeset arvados|commit:83c0e051c3611b021d7f0e2ea58d10c67c92698d.
Also available in: Atom
PDF