-
Notifications
You must be signed in to change notification settings - Fork 10.3k
fix(postgres): payment ledger outstanding query groupby #51556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe pull request modifies SQL query construction in Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-12-23T11:28:49.128ZApplied to files:
📚 Learning: 2025-12-16T05:33:58.723ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@ili-ad |
Summary
Fix Sales Invoice submit crash on Postgres in Payment Ledger outstanding computation by making GROUP BY deterministic.
Problem
Submitting a Sales Invoice on Postgres can fail with:
Root cause: the voucher/outstanding CTE queries select
account(and other non-aggregated fields) while using SUM(...) without including those fields in GROUP BY, which Postgres rejects.Fix
account, voucher identifiers, and party identifiers)MAX(...)for “decorator” fields that are stable per group (posting_date, due_date, currency, cost_center, remarks)This keeps the logic deterministic and Postgres-compliant without changing behavior on MariaDB/MySQL.
Tests
pre-commit run --all-files✅