[ 
https://issues.apache.org/jira/browse/FINERACT-1556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18050959#comment-18050959
 ] 

Georgi Kolev commented on FINERACT-1556:
----------------------------------------

I was able to reproduce a failure on PostgreSQL with the _Active Loans – 
Details_ stretchy report and wanted to share concrete findings and ask for 
guidance on next steps.

*Environment*
 * Apache Fineract (commit {{{}e17303fcb9a9bd38cf6afe57e7a205a5a911cf63{}}})

 * PostgreSQL

 * Default demo tenant

*Reproduction*
Calling the report endpoint without providing required {{R_*}} parameters fails:
GET /fineract-provider/api/v1/runreports/Active Loans - Details
GET /fineract-provider/api/v1/runreports/Active Loans - Details?template=true
Both result in:
 * HTTP 403

 * {{org.springframework.jdbc.BadSqlGrammarException}}

Server log shows:
org.postgresql.util.PSQLException: ERROR: syntax error at or near "$"
This appears to happen because the report SQL still contains unsubstituted 
placeholders (e.g. {{{}${officeId}{}}}, {{{}${currencyId}{}}}, etc.), and 
PostgreSQL errors when encountering {{$}} in the SQL.

When all required parameters are provided explicitly:
?R_officeId=1&R_loanOfficerId=-1&R_currencyId=-1&R_fundId=-1&R_loanProductId=-1&R_loanPurposeId=-1
the report executes successfully on PostgreSQL.

*Observation*
 * The {{template=true}} mode still attempts to parse/execute the report SQL.

 * It does not return parameter metadata unless all {{R_*}} parameters are 
supplied.

 * This makes it difficult for UIs or clients to discover required parameters 
without prior knowledge.

*Question*
Is this the expected behavior for {{{}template=true{}}}, or should template 
mode avoid SQL execution and return parameter definitions without requiring 
substitution?

If this behavior is unintended, I’m happy to help investigate or propose a 
fix—please advise on the preferred approach.

Thanks!

>  Stretchy Reports Are Not Working With Postgres
> -----------------------------------------------
>
>                 Key: FINERACT-1556
>                 URL: https://issues.apache.org/jira/browse/FINERACT-1556
>             Project: Apache Fineract
>          Issue Type: Bug
>            Reporter: Shemin Anto
>            Priority: Minor
>              Labels: beginner-friendly, postgres
>         Attachments: image-2022-03-30-12-24-59-814.png, 
> image-2022-03-30-12-25-07-774.png
>
>
> !image-2022-03-30-12-24-59-814.png|width=439,height=160!
> !image-2022-03-30-12-25-07-774.png|width=431,height=124!
> Showing Error when a particular report is opened



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to