Skip to content

fix: filter logic — NULL handling, BETWEEN plugin path, IN/NOT IN (#706) - #718

Merged
datlechin merged 1 commit into
mainfrom
fix/filter-logic-null-handling
Apr 13, 2026
Merged

datlechin merged 1 commit into
mainfrom
fix/filter-logic-null-handling

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

Fixes filter logic inconsistencies compared to TablePlus behavior. Three bugs fixed with 8 new exact-output tests.

Closes #706

Fixes

A. = NULL auto-converts to IS NULL (matches TablePlus)

Before: col = NULL — always false in SQL, never matches NULL rows
After: col IS NULL — correctly matches NULL rows

Same for != NULL → IS NOT NULL. Case-insensitive (null, Null, NULL all work).

B. BETWEEN secondValue included in plugin-dispatch path

Before: Plugin tuple was (column, operator, value) — secondValue dropped, BETWEEN broken for MSSQL and all plugin-implemented filter paths
After: BETWEEN values combined as "value1,value2" in the tuple for plugin parsing

D. IN/NOT IN with NULL values handled correctly

Before: IN (1, NULL, 3) — SQL IN (NULL) never matches NULL rows
After: (col IN (1, 3) OR col IS NULL) — compound condition handles NULL correctly

Same for NOT IN: (col NOT IN (1, 3) AND col IS NOT NULL)

Tests added (8 new)

  • Equal with NULL → IS NULL (uppercase + lowercase)
  • Not Equal with NULL → IS NOT NULL
  • Equal with regular string (regression guard)
  • IN list containing NULL → OR IS NULL
  • NOT IN list containing NULL → AND IS NOT NULL
  • IN list without NULL (regression guard)
  • IN list with only NULL → IS NULL

Test plan

  • Filter with = operator and value NULL → should match NULL rows
  • Filter with != operator and value NULL → should exclude NULL rows
  • Filter with IN operator and value 1, NULL, 3 → should match rows with id 1, 3, or NULL
  • Filter with BETWEEN on MSSQL connection → should work correctly
  • Existing filters (equals, contains, etc.) still work unchanged

@datlechin
datlechin merged commit 68a04ca into main Apr 13, 2026
2 checks passed
@datlechin
datlechin deleted the fix/filter-logic-null-handling branch April 13, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter logic inconsistencies — compare with TablePlus behavior

1 participant