[PR #2260] [MERGED] fix: merge AND-joined sub-table filters into single EXISTS subquery #4018

Closed
opened 2026-03-22 14:58:53 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2260
Author: @kolaente
Created: 2/18/2026
Status: Merged
Merged: 2/19/2026
Merged by: @kolaente

Base: mainHead: fix-subtable-filter-multi-row-matching


📝 Commits (9)

  • 01e3db6 test: add task #47 with reminders outside window for bug #2245
  • 9d3fc7c test: add failing test for sub-table filter multi-row matching bug #2245
  • f65ba64 fix: merge AND-joined sub-table filters into single EXISTS subquery
  • 338aca3 test: update expected task index after adding task #47 fixture
  • b455614 test: add OR-joined reminder filter regression test
  • 75f0588 style: fix alignment in test case
  • d1ef701 fix: only merge range comparators in sub-table filter grouping
  • 097891d fix(tests): update web test assertions for new task47 fixture
  • 313bc5c fix(tests): properly assert sort order including task47 in web tests

📊 Changes

6 files changed (+237 additions, -25 deletions)

View changed files

📝 pkg/db/fixtures/task_reminders.yml (+19 -0)
📝 pkg/db/fixtures/tasks.yml (+8 -0)
📝 pkg/models/task_collection_test.go (+136 -0)
📝 pkg/models/task_search.go (+69 -20)
📝 pkg/models/tasks_test.go (+1 -1)
📝 pkg/webtests/task_collection_test.go (+4 -4)

📄 Description

Summary

  • When multiple AND-joined filter conditions target the same sub-table (e.g., reminders > X && reminders < Y), they are now combined into a single EXISTS subquery so that all conditions must be satisfied by the same row
  • Previously, each condition generated a separate EXISTS subquery that could match different rows, causing false positives (e.g., a task with reminders at 2018-08-01 and 2019-03-01 would incorrectly match a filter for reminders > 2018-10-01 && reminders < 2018-12-10)
  • OR-joined conditions and conditions targeting different sub-tables continue to produce separate subqueries as before

Fixes #2245


🔄 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/go-vikunja/vikunja/pull/2260 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 2/18/2026 **Status:** ✅ Merged **Merged:** 2/19/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-subtable-filter-multi-row-matching` --- ### 📝 Commits (9) - [`01e3db6`](https://github.com/go-vikunja/vikunja/commit/01e3db61715264209850e376c60595946225849d) test: add task #47 with reminders outside window for bug #2245 - [`9d3fc7c`](https://github.com/go-vikunja/vikunja/commit/9d3fc7cf7c9f6a865e9dd34326db8c9be1f2964e) test: add failing test for sub-table filter multi-row matching bug #2245 - [`f65ba64`](https://github.com/go-vikunja/vikunja/commit/f65ba645828ece2e6c25081946318fa4262a74d0) fix: merge AND-joined sub-table filters into single EXISTS subquery - [`338aca3`](https://github.com/go-vikunja/vikunja/commit/338aca358613bb97862060db28617823fc5d33df) test: update expected task index after adding task #47 fixture - [`b455614`](https://github.com/go-vikunja/vikunja/commit/b455614077733fc46af94193ca01fe9dfc1be192) test: add OR-joined reminder filter regression test - [`75f0588`](https://github.com/go-vikunja/vikunja/commit/75f0588dc5203ae232663fce3a5e4af1e33cbc2b) style: fix alignment in test case - [`d1ef701`](https://github.com/go-vikunja/vikunja/commit/d1ef701cc240f2687d823704d7adc46809d57858) fix: only merge range comparators in sub-table filter grouping - [`097891d`](https://github.com/go-vikunja/vikunja/commit/097891d30e3dd944a1df838d45c83dd11c7a3314) fix(tests): update web test assertions for new task47 fixture - [`313bc5c`](https://github.com/go-vikunja/vikunja/commit/313bc5c1b84126ce094e081ebba10a40860b1a89) fix(tests): properly assert sort order including task47 in web tests ### 📊 Changes **6 files changed** (+237 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `pkg/db/fixtures/task_reminders.yml` (+19 -0) 📝 `pkg/db/fixtures/tasks.yml` (+8 -0) 📝 `pkg/models/task_collection_test.go` (+136 -0) 📝 `pkg/models/task_search.go` (+69 -20) 📝 `pkg/models/tasks_test.go` (+1 -1) 📝 `pkg/webtests/task_collection_test.go` (+4 -4) </details> ### 📄 Description ## Summary - When multiple AND-joined filter conditions target the same sub-table (e.g., `reminders > X && reminders < Y`), they are now combined into a single `EXISTS` subquery so that all conditions must be satisfied by the same row - Previously, each condition generated a separate `EXISTS` subquery that could match different rows, causing false positives (e.g., a task with reminders at `2018-08-01` and `2019-03-01` would incorrectly match a filter for `reminders > 2018-10-01 && reminders < 2018-12-10`) - OR-joined conditions and conditions targeting different sub-tables continue to produce separate subqueries as before Fixes #2245 --- <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-03-22 14:58:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#4018