[PR #5799] [CLOSED] [WIP] Fix actual budget issue 5616 #6128

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

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/5799
Author: @MatissJanis
Created: 9/27/2025
Status: Closed

Base: masterHead: cursor/fix-actual-budget-issue-5616-d185


📝 Commits (7)

📊 Changes

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

View changed files

📝 packages/loot-core/src/server/aql/compiler.test.ts (+42 -0)
📝 packages/loot-core/src/server/aql/compiler.ts (+42 -3)
upcoming-release-notes/5799.md (+7 -0)

📄 Description

Fixes #5616

This PR resolves an issue where ActualQL queries using mapped fields in join paths (e.g., category.group.name) failed with a no such column error.

The compileJoins function in the AQL compiler was not correctly applying schema field mappings (like group to cat_group) when constructing SQL join conditions. This fix enhances compileJoins to properly resolve the target table and apply the configured field mappings, ensuring the generated SQL uses the correct database column names.


Open in Cursor Open in Web


Note

Ensure JOIN conditions respect views.fields mappings (e.g., group -> cat_group) and add a test verifying correct SQL generation.

  • AQL Compiler:
    • Update compileJoins to resolve and apply schemaConfig.views.*.fields mappings for join fields, handling table IDs to actual table names.
    • Pass schemaConfig into compileJoins from compileQuery.
  • Tests:
    • Add test in packages/loot-core/src/server/aql/compiler.test.ts verifying category.group.name joins use categories.cat_group and not categories."group".

Written by Cursor Bugbot for commit d1d48e992a. This will update automatically on new commits. Configure here.


🔄 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/5799 **Author:** [@MatissJanis](https://github.com/MatissJanis) **Created:** 9/27/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `cursor/fix-actual-budget-issue-5616-d185` --- ### 📝 Commits (7) - [`0ed0fe4`](https://github.com/actualbudget/actual/commit/0ed0fe427ddf5ad0e9dab53fb50f569188c47212) Fix: Map field names in join conditions for AQL - [`d1d48e9`](https://github.com/actualbudget/actual/commit/d1d48e992a76cd9348600a1626daf90a17e29814) [autofix.ci] apply automated fixes - [`594ad33`](https://github.com/actualbudget/actual/commit/594ad330c7608ab0a3212bdfc5e5bfa99d260ba9) Refactor AQL join field mapping logic - [`33ac7e2`](https://github.com/actualbudget/actual/commit/33ac7e25efebaf1fcdc3641a580613f20424dfe9) Add release notes for PR #5799 - [`8fefbb0`](https://github.com/actualbudget/actual/commit/8fefbb0a6c9455af8e0b7f89803042a6dfb13240) Merge branch 'cursor/fix-actual-budget-issue-5616-d185' of https://github.com/actualbudget/actual into cursor/fix-actual-budget-issue-5616-d185 - [`c5b779b`](https://github.com/actualbudget/actual/commit/c5b779b88dc7112e4fb0a0196d24be35f8f96505) [autofix.ci] apply automated fixes - [`9c2760b`](https://github.com/actualbudget/actual/commit/9c2760b29771f0929fa4562db74a0da591af4c3e) Merge branch 'master' into cursor/fix-actual-budget-issue-5616-d185 ### 📊 Changes **3 files changed** (+91 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/aql/compiler.test.ts` (+42 -0) 📝 `packages/loot-core/src/server/aql/compiler.ts` (+42 -3) ➕ `upcoming-release-notes/5799.md` (+7 -0) </details> ### 📄 Description <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes. Try running yarn generate:release-notes *before* pushing your PR for an interactive experience. --> Fixes #5616 This PR resolves an issue where ActualQL queries using mapped fields in join paths (e.g., `category.group.name`) failed with a `no such column` error. The `compileJoins` function in the AQL compiler was not correctly applying schema field mappings (like `group` to `cat_group`) when constructing SQL join conditions. This fix enhances `compileJoins` to properly resolve the target table and apply the configured field mappings, ensuring the generated SQL uses the correct database column names. --- <a href="https://cursor.com/background-agent?bcId=bc-92699ae5-c6ab-400a-8ad3-4fdea85f4b05"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a href="https://cursor.com/agents?id=bc-92699ae5-c6ab-400a-8ad3-4fdea85f4b05"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web" src="https://cursor.com/open-in-web.svg"></picture></a> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Ensure JOIN conditions respect `views.fields` mappings (e.g., `group` -> `cat_group`) and add a test verifying correct SQL generation. > > - **AQL Compiler**: > - Update `compileJoins` to resolve and apply `schemaConfig.views.*.fields` mappings for join fields, handling table IDs to actual table names. > - Pass `schemaConfig` into `compileJoins` from `compileQuery`. > - **Tests**: > - Add test in `packages/loot-core/src/server/aql/compiler.test.ts` verifying `category.group.name` joins use `categories.cat_group` and not `categories."group"`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d1d48e992a76cd9348600a1626daf90a17e29814. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --- <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:24:20 -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#6128