Skip to content
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

Display unmapped schema names in error messages BABEL5 #3310

Conversation

chxwang
Copy link
Contributor

@chxwang chxwang commented Dec 24, 2024

Description

Previously, Babelfish displays the mapped schema names in error messages. This commit implements a hook function remove_db_name_in_schema and adds test cases. Original unmapped name will be displayed with this commit.

Issues Resolved

BABEL-2961

Test Scenarios Covered

  • Use case based -

  • Boundary conditions - NA

  • Arbitrary inputs - NA

  • Negative test cases - NA

  • Minor version upgrade tests - NA

  • Major version upgrade tests - NA

  • Performance tests - NA

  • Tooling impact - NA

  • Client tests - NA

Check List

  • Commits are signed per the DCO using --signoff

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.

…ges. This commit implements a hook function remove_db_name_in_schema and adds test cases. Original unmapped name will be displayed with this commit.

Signed-off-by: Chenxiao Wang <[email protected]>
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 12485963728

Details

  • 20 of 21 (95.24%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.003%) to 74.862%

Changes Missing Coverage Covered Lines Changed/Added Lines %
contrib/babelfishpg_tsql/src/hooks.c 20 21 95.24%
Files with Coverage Reduction New Missed Lines %
contrib/babelfishpg_tds/src/backend/tds/tdsutils.c 2 73.66%
Totals Coverage Status
Change from base Build 12485768578: 0.003%
Covered Lines: 46589
Relevant Lines: 62233

💛 - Coveralls

db_name_len = strlen(cur_db_name);
schema_name_len = strlen(schema_name);

if (schema_name != NULL && schema_name_len > db_name_len && strncmp(schema_name, cur_db_name, db_name_len) == 0 && schema_name[db_name_len] == '_') {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can look at the babelfish catalog for original schema name instead. we have syscache for it as well. SYSNAMESPACENAME

* @return - unmapped schema name char *
*/
static const char *
remove_db_name_in_schema(const char *object_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think hook should not be called for non tds connections.

@chxwang chxwang closed this Dec 27, 2024
@chxwang chxwang deleted the jira-babel-2961-5 branch December 27, 2024 21:36
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.

3 participants