Fix NON_UNIQUE value inconsistency in DatabaseMetaData.getIndexInfo() - #2773
Merged
Conversation
Muskan Gupta (muskan124947)
approved these changes
Sep 15, 2025
Divang Sharma (divang)
approved these changes
Sep 15, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2773 +/- ##
=========================================
Coverage 52.32% 52.32%
- Complexity 4140 4151 +11
=========================================
Files 149 149
Lines 34241 34241
Branches 5718 5718
=========================================
+ Hits 17915 17916 +1
- Misses 13830 13838 +8
+ Partials 2496 2487 -9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Mahendra Chavan (machavan)
approved these changes
Sep 15, 2025
Ananya Garg (Ananya2)
added a commit
that referenced
this pull request
Sep 15, 2025
Ananya Garg (Ananya2)
added a commit
that referenced
this pull request
Sep 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DatabaseMetaData.getIndexInfo() was returning incorrect NON_UNIQUE values due to inconsistent handling between sp_statistics and sys.indexes result sets.
The method was merging results from both sources without properly converting the sys.indexes.is_unique values to the expected JDBC NON_UNIQUE format, causing the same index to appear as both unique and non-unique.
Solution
CASE WHEN i.is_unique = 1 THEN 0 ELSE 1 END AS NON_UNIQUETesting
Closes #2771