Skip to content

Update getProcedureColumns() and getFunctionColumns() to return name without numbered prefixes#2743

Closed
muskan124947 wants to merge 3 commits intomainfrom
users/muskgupta/gitHubIssue#2739
Closed

Update getProcedureColumns() and getFunctionColumns() to return name without numbered prefixes#2743
muskan124947 wants to merge 3 commits intomainfrom
users/muskgupta/gitHubIssue#2739

Conversation

@muskan124947
Copy link
Copy Markdown
Contributor

@muskan124947 muskan124947 commented Aug 20, 2025

Description

This PR addresses GitHub reported issue : Cannot relate procedures to procedure columns (same with functions) #2739

Post fixing the issue Use sys.all_objects for accurate function and procedure filtering #2705 : where both DatabaseMetadata.getProcedures and DatabaseMetadata.getFunctions returns correct result. With this change object names got updated as mentioned below:

Old behaviour: sp_testProc;1
New behaviour: sp_testProc

So, DatabaseMetadata.getProcedureColumns and DatabaseMetadata.getFunctionColumns should also return similar pattern.
Currently it returns the resultset where procedure and function names were appended with a numbered suffix (;1).

As per the documentation : “Numbered procedures are deprecated. Avoid using them in new development work, and plan to modify applications that currently use them.”

Fix

Updated the implementation of getProcedureColumns() and getFunctionColumns() to filter out numbered suffixes from procedure/function names.
This ensures that the returned column metadata reflects only the expected procedure/function names.

Testing

  • Manual testing: Verified locally with custom scripts to ensure that getProcedureColumns() and getFunctionColumns() return accurate object names without numbered suffixes.
  • Automated tests: Added testGetProcedureColumnsWithValidation and testGetFunctionColumnsWithValidation to confirm that procedure and function column names are correctly validated.

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 20, 2025

Codecov Report

❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.55%. Comparing base (e1acc9e) to head (d9f640c).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...soft/sqlserver/jdbc/SQLServerDatabaseMetaData.java 62.50% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2743      +/-   ##
============================================
+ Coverage     51.51%   51.55%   +0.03%     
- Complexity     4081     4082       +1     
============================================
  Files           149      149              
  Lines         34268    34276       +8     
  Branches       5725     5727       +2     
============================================
+ Hits          17654    17670      +16     
+ Misses        14125    14110      -15     
- Partials       2489     2496       +7     

☔ 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.

/**
* Provides filter to remove numbered prefixes from procedure names.
*/
class ColumnNameFilter extends ColumnFilter {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can rename to ProcNameFilter

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be used for getFunctionColumns() also

Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
@muskan124947 muskan124947 requested review from Ananya2 and divang August 21, 2025 07:38
@muskan124947 muskan124947 added this to the 13.2.1 milestone Aug 21, 2025
@muskan124947 muskan124947 self-assigned this Aug 21, 2025
@muskan124947 muskan124947 changed the title Update procedureColumns() to return name without numbered prefixes Update getProcedureColumns() and getFunctionColumns() to return name without numbered prefixes Aug 21, 2025
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.

Cannot relate procedures to procedure columns (same with functions)

3 participants