adamsaghy commented on PR #6494:
URL: https://github.com/apache/fineract/pull/6494#issuecomment-6415925470

   Thanks @AshharAhmadKhan, removing the wrapper for user report SQL is fine 
with me. The DB is MariaDB: it drops the ORDER BY inside a derived table that 
has no LIMIT. MySQL and PostgreSQL keep it, which is why you couldn't reproduce 
on PG.
   
   One thing beyond `getColumnLabel` for the headers: `fillResultsetRowData` 
also reads values with `rs.getObject(rsmd.getColumnName(i + 1))`. Without the 
wrapper, on MySQL/MariaDB two aliased columns from the same source column 
(`l.id AS loan_id, l2.id AS other_id`) both resolve to the first one and return 
the same value without any error. Please read by position (`rs.getObject(i + 
1)`) instead. `DatatableUtil` uses `select *` and already matches headers by 
position, so it's unaffected.
   
   Please only drop the wrap in `buildPreparedQuery`, and remove the lifter and 
its tests. Add an integration test that runs on MariaDB, with a report whose 
ORDER BY differs from primary-key order and two aliased columns from the same 
source column. Also note in the PR that report SQL the wrapper used to reject 
(a trailing `;`, statements that aren't a SELECT) will now run.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to