[PR #3686] [MERGED] Fixes #3682 - Fix $ne filters incorrectly excluding null values #5003

Closed
opened 2026-02-28 21:04:31 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/3686
Author: @joel-rich
Created: 10/17/2024
Status: Merged
Merged: 11/5/2024
Merged by: @joel-jeremy

Base: masterHead: ne-query-fix


📝 Commits (4)

  • fd42023 allow matching null values when not equals query filter is set
  • 9721eb2 Also fix namedParameter queries with filter
  • 4bbbb0d improve tests
  • c336e9a release note

📊 Changes

3 files changed (+53 additions, -3 deletions)

View changed files

📝 packages/loot-core/src/server/aql/compiler.ts (+3 -3)
📝 packages/loot-core/src/server/aql/exec.test.ts (+44 -0)
upcoming-release-notes/3686.md (+6 -0)

📄 Description

Fixes #3682

As described in the ticket, any "is not" or "not one of" filters currently exclude the specified value(s) and also exclude null values.

Reproduce by filtering All Transactions to exclude any category - all off-budget or categorized transactions also get filtered out.

Given, example list dataset of Items (name, colour)

"Banana", "Yellow"
"Lime", "Yellow"
"Air", null
"Car", "Red"

And query of select * from Items where colour != "Yellow",

Old result set (incorrectly excluding both null and "Yellow" Items):
"Car", "Red"

After my change, the new result set returns all Items which aren't yellow:

"Air", null
"Car", "Red"

I wrote a couple tests for namedParameter queries and no existing tests are failing, but even still I'm not overly confident in the changes on lines 709-710 due to it being a weird bit of sql and I'm not a sql expert. I would appreciate it if someone with more sql knowledge confirms it won't have any weird edge-cases I didn't think to test for.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/3686 **Author:** [@joel-rich](https://github.com/joel-rich) **Created:** 10/17/2024 **Status:** ✅ Merged **Merged:** 11/5/2024 **Merged by:** [@joel-jeremy](https://github.com/joel-jeremy) **Base:** `master` ← **Head:** `ne-query-fix` --- ### 📝 Commits (4) - [`fd42023`](https://github.com/actualbudget/actual/commit/fd42023f68a997f477c94e47ac073cb45291f724) allow matching null values when not equals query filter is set - [`9721eb2`](https://github.com/actualbudget/actual/commit/9721eb28a4b6e41d85d98b32447e2a3e39e35f57) Also fix namedParameter queries with filter - [`4bbbb0d`](https://github.com/actualbudget/actual/commit/4bbbb0d700b482b36b05f9148d86fc6fc05de86d) improve tests - [`c336e9a`](https://github.com/actualbudget/actual/commit/c336e9a326a5051846504a7f69041b6d635b9494) release note ### 📊 Changes **3 files changed** (+53 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/aql/compiler.ts` (+3 -3) 📝 `packages/loot-core/src/server/aql/exec.test.ts` (+44 -0) ➕ `upcoming-release-notes/3686.md` (+6 -0) </details> ### 📄 Description Fixes #3682 As described in the ticket, any "is not" or "not one of" filters currently exclude the specified value(s) and also exclude null values. Reproduce by filtering All Transactions to exclude any category - all off-budget or categorized transactions also get filtered out. Given, example list dataset of Items (name, colour) ``` "Banana", "Yellow" "Lime", "Yellow" "Air", null "Car", "Red" ``` And query of `select * from Items where colour != "Yellow"`, Old result set (incorrectly excluding both null and "Yellow" Items): `"Car", "Red"` After my change, the new result set returns all Items which aren't yellow: ``` "Air", null "Car", "Red" ``` ----- I wrote a couple tests for namedParameter queries and no existing tests are failing, but even still I'm not overly confident in the changes on lines 709-710 due to it being a weird bit of sql and I'm not a sql expert. I would appreciate it if someone with more sql knowledge confirms it won't have any weird edge-cases I didn't think to test for. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 21:04:31 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#5003