Add allow_nil option for IS NULL filtering on non-JSONB types#84
Open
raafatalaa wants to merge 1 commit into
Open
Add allow_nil option for IS NULL filtering on non-JSONB types#84raafatalaa wants to merge 1 commit into
raafatalaa wants to merge 1 commit into
Conversation
d1a1dea to
438596e
Compare
jakesanders
approved these changes
Jun 17, 2026
andrew-wheeler
approved these changes
Jun 22, 2026
Consumers can now opt in to null filtering by declaring `filter_on :col, type: :int, allow_nil: true`. When enabled, passing the string "null" as a filter value produces `WHERE col IS NULL`, and combining it with real values (e.g. `["null", "5"]`) produces `WHERE col IS NULL OR col IN (5)`. Filters without `allow_nil: true` are unaffected — the existing behavior is fully preserved. Closes procore-oss#81 Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: raafatalaa <raafat.alaa@procore.com> Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: raafatalaa <raafat.alaa@procore.com> Co-authored-by: Cursor <cursoragent@cursor.com>
438596e to
c0ba0e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
allow_nil: trueoption tofilter_onthat enablesIS NULLfiltering for non-JSONB column types"null"as a filter value producesWHERE col IS NULL"null"with real values (e.g.["null", "5"]) producesWHERE col IS NULL OR col IN (5)allow_nil: trueare unaffected — existing behavior is fully preservedUsage
Closes #81
Test plan
filters[col]=nullwithallow_nil: true→WHERE col IS NULLfilters[col]=NULL(uppercase) withallow_nil: true→ same behaviorfilters[col][]=null&filters[col][]=5withallow_nil: true→WHERE col IS NULL OR col IN (5)filters[col]=nullon a string column withallow_nil: true→WHERE col IS NULLfilters[col]=nullwithoutallow_nil→ returns 400 validation error (for int type)