Skip to content

FINERACT-2973: Fix ad-hoc loan search on PostgreSQL - #6701

Open
Aarti-panchal01 wants to merge 1 commit into
apache:developfrom
Aarti-panchal01:fix-adhoc-search-count-alias
Open

Aarti-panchal01 wants to merge 1 commit into
apache:developfrom
Aarti-panchal01:fix-adhoc-search-count-alias

Conversation

@Aarti-panchal01

Copy link
Copy Markdown

Description

POST /search/advance (the ad-hoc loan search behind the Fund Mapping page) returns a 500 on PostgreSQL. The query aliases a column as 'count' in single quotes, which PostgreSQL rejects (syntax error at or near "'count'"); MySQL and MariaDB accept it. The alias is now unquoted (a.cnt as count), which works on all three, and the row mapper already reads the column as count.

Added a unit test in SearchReadServiceImplTest that checks the generated SQL has no quoted alias. It fails on develop and passes with this change.

Tested on a local Fineract with PostgreSQL 18: the request returned a 500 before the change and the grouped loans after it.

JIRA: https://issues.apache.org/jira/browse/FINERACT-2973

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per our guidelines
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our coding conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.
  • I followed the AI Policy.

@Aarti-panchal01

Aarti-panchal01 commented Oct 20, 2026 •

Copy link
Copy Markdown
Author

The first CI run failed on PostgreSQL shard 6 before any test ran: Maven Central did not return org.jacoco.agent-0.8.14.jar ("Could not find org.jacoco.agent-0.8.14.jar" in every module). I re-pushed the same change (only the commit date changed) to rerun it.

POST /search/advance failed on PostgreSQL with a syntax error because
the query in SearchReadServiceImpl aliased a column as 'count' in single
quotes, which PostgreSQL does not accept (MySQL and MariaDB do). Alias
it without quotes; the row mapper already reads the column as count.

Assisted-By: Claude Opus 5.5
@Aarti-panchal01
Aarti-panchal01 force-pushed the fix-adhoc-search-count-alias branch from 2b6b108 to 411936f Compare October 20, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant