Repository navigation
FINERACT-3378: Fix seeded reports that differ on PostgreSQL - #7199
Open
Abhishek6122008 wants to merge 1 commit into
Open
Abhishek6122008 wants to merge 1 commit into
Abhishek6122008 wants to merge 1 commit into
Conversation
Seeded reports returned different results on PostgreSQL than on MySQL/MariaDB for the same data:
- FINERACT-3396: Active Loans - Summary counted every active loan as in arrears
(coalesce(laa.loan_id, l.id, NULL)); two labels had runs of spaces.
- FINERACT-3397: Loan fully repaid returned one row per installment; now one per loan with the last
installment's due date, on both databases (also fixes MySQL 8's ONLY_FULL_GROUP_BY).
- FINERACT-3398: Dormant Prospects counted only the months part of the age (0 to 11).
- FINERACT-3399: GeneralLedgerReport Table had no account_name column, and 'system' instead of '0system'.
- FINERACT-3400: TxnRunningBalances had no Amount column and no running totals; now window sums from the
opening balance.
- FINERACT-3401: eight reports returned timestamps (DATE_TRUNC('day', x)) instead of dates.
- FINERACT-3402: the weekly trends reports use ISO weeks on both databases and sort by week.
Tests for 3396, 3399, 3400, 3401 and 3402 in StretchyReportsSmokeTest.
Abhishek6122008
force-pushed
the
feature/FINERACT-3378-report-sql-differences
branch
from
December 6, 2026 01:49
feea872 to
694b1be
Compare
Contributor
Author
|
Could someone rerun the failed E2E Shard 12 job? The runner crashed ("lost communication with the server"), so it isn't a test failure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
https://issues.apache.org/jira/browse/FINERACT-3378
Seeded reports that returned different results on PostgreSQL than on MySQL/MariaDB for the same data. One commit per sub-task, all in
0297_fix_report_sql_differences_between_databases.xml. Small fixes replace only the part that differs, so a report a bank has edited is left alone when its text no longer matches.coalesce(laa.loan_id, l.id, NULL)counted every active loan as in arrears; nowCASE WHEN laa.loan_id IS NOT NULL THEN l.id END. Two labels lose their runs of spaces.ONLY_FULL_GROUP_BY).DATE_PART('MONTH', AGE(...))is 0-11; now years * 12 + months, likeTIMESTAMPDIFF(MONTH, ...).account_name; system entries get0systemlike MySQL.Amountcolumn. Outstanding Principal, Interest Income and Principal Write Off were per-transaction amounts; they are now running totals (window sums in date, id order) from the opening balance.DATE_TRUNC('day', x)returned timestamps; nowCAST(x AS DATE).WEEK(x, 3), same as PostgreSQL'sEXTRACT(WEEK ...)for every day 2018-2030), and both sort by week.How it was checked:
TIMESTAMPDIFFfor every day from 2020 against four end dates (month ends, a leap day).ORDER BYinside a derived table, which MariaDB ignores, so its totals accumulate in no particular order. Not changed here.StretchyReportsSmokeTestgets tests for 3396, 3399, 3400, 3401 and 3402 (Loan fully repaid and Dormant Prospects need data the setup can't create). Built this branch and ran the smoke test against fresh PostgreSQL and MariaDB databases: 49/49 on both. CI covers MySQL.Not in this PR: GeneralLedgerReport Table's opening balance differs too, because both versions use a date condition that isn't an opening balance (MySQL
>= start - 2 days, PostgreSQL<= start - 3 days). Choosing the right rule changes both, so I'll raise it on FINERACT-3399 first. Related: #7196 (FINERACT-3377,NOW()in report SQL).Checklist
Your assigned reviewer(s) will follow our guidelines for code reviews.