-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue with sp_tables failing for cross-database table qualifiers #2961
Merged
shardgupta
merged 2 commits into
babelfish-for-postgresql:BABEL_4_X_DEV
from
amazon-aurora:JIRA-BABEL-5263
Sep 27, 2024
Merged
Fix issue with sp_tables failing for cross-database table qualifiers #2961
shardgupta
merged 2 commits into
babelfish-for-postgresql:BABEL_4_X_DEV
from
amazon-aurora:JIRA-BABEL-5263
Sep 27, 2024
Conversation
This file contains 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
This fix resolves the issue where sp_tables fails when a three-part object name is used with a database qualifier different from the current database. The root cause was identified as sys.db_name() returning the incorrect database name based on the object qualifier in certain contexts. By replacing this with a direct select of sys.db_name(), the correct database name is fetched ensuring proper handling of cross-database references. Task: BABEL-5263 Signed-off-by: Roshan Kanwar <[email protected]>
Pull Request Test Coverage Report for Build 11013371085Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
LGTM but need verification on fix for SSMS. Lets add the testing done with SSMS to the description. |
KushaalShroff
approved these changes
Sep 27, 2024
thephantomthief
approved these changes
Sep 27, 2024
shardgupta
merged commit Sep 27, 2024
ba6df87
into
babelfish-for-postgresql:BABEL_4_X_DEV
46 checks passed
roshan0708
added a commit
to amazon-aurora/babelfish_extensions
that referenced
this pull request
Sep 27, 2024
…abelfish-for-postgresql#2961) This change fixes an issue with the sp_tables stored procedure, which incorrectly handled three-part object names across databases, throwing an error regarding database context. The root cause was sys.db_name() returning the wrong database name based on the object qualifier. The issue affected the usability of linked servers in Babelfish, as it prevented accurate metadata retrieval, limiting compatibility with SQL Server. The fix replaced sys.db_name() with a direct SELECT sys.db_name() to fetch the correct database name before comparing it against the table_qualifier. Task: BABEL-5263 Signed-off-by: Roshan Kanwar <[email protected]>
1 task
shardgupta
pushed a commit
that referenced
this pull request
Sep 27, 2024
…2961) (#2984) This change fixes an issue with the sp_tables stored procedure, which incorrectly handled three-part object names across databases, throwing an error regarding database context. The root cause was sys.db_name() returning the wrong database name based on the object qualifier. The issue affected the usability of linked servers in Babelfish, as it prevented accurate metadata retrieval, limiting compatibility with SQL Server. The fix replaced sys.db_name() with a direct SELECT sys.db_name() to fetch the correct database name before comparing it against the table_qualifier. Task: BABEL-5263 Signed-off-by: Roshan Kanwar <[email protected]>
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.
Description
This change fixes an issue with the
sp_tables
stored procedure, which incorrectly handled three-part object names across databases, throwing an error regarding database context. The root cause wassys.db_name()
returning the wrong database name based on the object qualifier.The issue affected the usability of linked servers in Babelfish, as it prevented accurate metadata retrieval, limiting compatibility with SQL Server.
The fix replaced
sys.db_name()
with a directSELECT sys.db_name()
to fetch the correct database name before comparing it against thetable_qualifier
.SSMS Testing
Created 3 databases -
master
,roshan
, andtestdb
and some dummy tables and views to executesp_tables
procedure.Issues Resolved
Task: BABEL-5263
Test Scenarios Covered
Use case based - yes
Boundary conditions - yes
Arbitrary inputs - yes
Negative test cases - yes
Minor version upgrade tests -
Major version upgrade tests -
Performance tests -
Tooling impact -
Client tests -
Check List
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.