Skip to content

Conversation

@divang
Copy link
Contributor

@divang divang commented Nov 4, 2025

Problem:
The DatabaseMetaData.supportsIntegrityEnhancementFacility() method incorrectly returns false for SQL Server databases. This method is part of the JDBC specification and indicates whether the database supports integrity enhancement facilities such as primary key and foreign key constraints. SQL Server has comprehensive support for these integrity features, but the driver was not accurately reporting this capability to applications. This could lead to applications incorrectly assuming that SQL Server lacks integrity constraint support, potentially affecting application logic and database schema decisions.

Root Cause:
The supportsIntegrityEnhancementFacility() method in SQLServerDatabaseMetaData.java was hardcoded to return false. This was an incorrect implementation as SQL Server fully supports integrity enhancement facilities including:
Primary key constraints
Foreign key constraints
Check constraints
Unique constraints
NOT NULL constraints

The method implementation did not reflect the actual capabilities of SQL Server, causing a mismatch between the database's features and what the driver reported.

Solution:
Updated the supportsIntegrityEnhancementFacility() method in SQLServerDatabaseMetaData.java to return true instead of false. This change aligns the driver's reported capabilities with SQL Server's actual support for integrity enhancement facilities. The fix ensures that applications using this metadata method will receive accurate information about SQL Server's constraint support capabilities.

@divang divang added this to the 13.3.0 milestone Nov 4, 2025
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.28%. Comparing base (e1acc9e) to head (0b6acfd).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2828      +/-   ##
============================================
+ Coverage     51.51%   56.28%   +4.77%     
- Complexity     4081     4520     +439     
============================================
  Files           149      149              
  Lines         34268    34378     +110     
  Branches       5725     5734       +9     
============================================
+ Hits          17654    19351    +1697     
+ Misses        14125    12397    -1728     
- Partials       2489     2630     +141     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@divang divang merged commit d339a25 into main Nov 4, 2025
19 checks passed
@machavan
Copy link
Contributor

@prrvchr ,

Thank you for contributing to this fix.

Your contribution does show up in this PR as above.

image

We need to follow this process for community PRs (we have done the same for previous set of community contributions) as we are not in position to run a set of internal tests to validate the PR with your contributed PRs. Hence, we create PRs out of your PRs with PR description in our template format, validate the tests and go ahead with the PR merge.

Your contribution is valuable and it does show up in the PR above.

Thanks

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.

5 participants