FINERACT-2468: Fix datatable operations in PostgreSQL non-public schemas#5452
Conversation
f37ed02 to
94ec550
Compare
|
Updated to use Changes made:
Regarding the CI failure: Thank you for your patience and review! |
|
please rebase this pr with latest develop branch |
94ec550 to
5f19dcc
Compare
|
@adamsaghy Rebased with latest develop (28f63cc). Ready for review! |
There was a problem hiding this comment.
One minor request: Please remove the inline comments (lines 47-48, 72-74) that reference the JIRA ticket and explain the "why".
In Fineract, we prefer to keep the source code clean. This context belongs in the Commit Message or the PR description, not hardcoded into the Java file. The code should be self-explanatory.
(P.S. Apologies for the duplicate notification from my work handle earlier; please ignore that one.)
5f19dcc to
f656463
Compare
|
@Saifulhuq01 Done! Removed all inline comments (lines 47-48 and 72-74) as requested. The code is now clean while preserving all functionality. Thanks for the feedback! |
@AshharAhmadKhan I’ve checked the latest commit and performed a hard refresh, but the inline comments on lines 47-48 and 72-74 are still appearing in the diff. Could you double-check that you successfully pushed the latest changes to your remote branch? I see a new commit but that was ""There isn’t anything to compare."" |
| // Use current_schema for consistency with getTableColumns() and getTableIndexes(). | ||
| // This ensures tenant-specific schemas work correctly (FINERACT-2468). |
There was a problem hiding this comment.
We dont need this comments!
| // Use current_schema instead of hardcoded 'public' to support tenant-specific schemas. | ||
| // This fixes datatable operations in multi-tenant PostgreSQL deployments where | ||
| // datatables reside in non-public schemas (FINERACT-2468). | ||
| String sql = "SELECT indexname FROM pg_indexes WHERE schemaname = current_schema() AND tablename = ?"; |
There was a problem hiding this comment.
We dont need this comments!
adamsaghy
left a comment
There was a problem hiding this comment.
Please remove the unnecessary comments!
Use current_schema instead of hardcoded 'public' in getTableIndexes() and isTablePresent() methods to support multi-tenant PostgreSQL deployments where datatables reside in tenant-specific schemas. This fixes: - GET /datatables returning 404 for new datatables - Datatable save operations failing with 'Datatable not found' Root cause: Index metadata queries were looking in 'public' schema while table columns query correctly used current_schema, causing inconsistent behavior in GenericDataServiceImpl. Changes: - PostgreSQLQueryService.getTableIndexes(): Use current_schema - PostgreSQLQueryService.isTablePresent(): Use current_schema Testing: - All unit tests pass (93/93 in fineract-core) - Manual PostgreSQL verification confirms fix works correctly
f656463 to
14e31f3
Compare
|
Comments removed successfully! All inline comments referencing FINERACT-2468 have been deleted from the code. The file is now clean with only the functional changes. Latest commit: 14e31f3 Ready for re-review! |
|
LGTM |
Summary
Fixes datatable operations in PostgreSQL deployments using non-public schemas by replacing hardcoded
'public'schema references withcurrent_schema.Related Issues
Description
When using PostgreSQL with tenant-specific schemas (non-public), creating a new datatable causes:
GET /datatablesto return 404 with "Datatable not found"Root Cause:
getTableIndexes()andisTablePresent()inPostgreSQLQueryService.javahardcoded'public'schema whilegetTableColumns()correctly usedcurrent_schema, causing inconsistent table discovery inGenericDataServiceImpl.Solution: Modified both methods to use
current_schemainstead of hardcoded'public', ensuring all table metadata queries use the connection's current schema.Changes Made
PostgreSQLQueryService.getTableIndexes(): Changedschemaname = 'public'toschemaname = current_schemaPostgreSQLQueryService.isTablePresent(): Changedtable_schema = 'public'totable_schema = current_schemaTesting Performed
current_schemaquery finds indexes while'public'query doesn't (reproduces original bug)Manual Verification:
Impact
Checklist
Notes