Hi @Adam Saghy, hi @Arnold Galovics,
After the two PostgreSQL fixes I opened (FINERACT-1821 cashier TIME(): https://github.com/apache/fineract/pull/6660 and FINERACT-2973 search alias: https://github.com/apache/fineract/pull/6701), I went looking for more of the same. I scanned all the hand-written SQL in src/main and replayed the Liquibase changelog to get the report SQL a PostgreSQL tenant actually runs.
The Java side is in good shape, almost everything goes through DatabaseSpecificSQLGenerator. The problems are mostly in the PostgreSQL copies of the stretchy reports from 0003_postgresql_specific_initial_data.xml, plus one in the helper itself:
After the two PostgreSQL fixes I opened (FINERACT-1821 cashier TIME(): https://github.com/apache/fineract/pull/6660 and FINERACT-2973 search alias: https://github.com/apache/fineract/pull/6701), I went looking for more of the same. I scanned all the hand-written SQL in src/main and replayed the Liquibase changelog to get the report SQL a PostgreSQL tenant actually runs.
The Java side is in good shape, almost everything goes through DatabaseSpecificSQLGenerator. The problems are mostly in the PostgreSQL copies of the stretchy reports from 0003_postgresql_specific_initial_data.xml, plus one in the helper itself:
- CAST(... AS CHAR) means char(1) on PostgreSQL, so "Portfolio at Risk %" shows only the first digit (12.34 becomes 1). It is in 5 core reports (Portfolio at Risk, PAR by Branch, Active Loans Summary and two maturity summaries), no error, just a wrong number.
- castChar() in DatabaseSpecificSQLGenerator returns x::CHAR for PostgreSQL, same truncation. It breaks the code value join for interest rate chart incentives (4 call sites).
- The Happy Birthday SMS report fails on PostgreSQL (EXTRACT on an integer), and its port also compares the full date with the year and drops the loanOfficerId filter.
- Smaller ones: TxnRunningBalances (DATE ? syntax error, loan officer hard-coded to 9), integer division in the staff dashboard reports, and m_tenant_oidc_config.enabled is SMALLINT on PostgreSQL while the repository binds a boolean.
- Would you like one umbrella ticket with a PR per area (reports, the castChar helper, OIDC), or separate tickets? For the report fixes, do you prefer full report_sql rewrites in a postgresql-context changeset like FINERACT-2436, or one regexp_replace changeset for the AS CHAR cases?
- None of these is covered by a test that runs a report. Would you accept a smoke integration test that runs every use_report=true Table report on the PG/MySQL/MariaDB shards and checks it returns headers? It would have caught most of these, and I think it is a better guard than trying to lint SQL strings.