babelfish-for-postgresql / babelfish_extensions

Babelfish for PostgreSQL provides the capability for PostgreSQL to work with applications written for Microsoft SQL Server. Babelfish understands the SQL Server wire-protocol and T-SQL, the Microsoft SQL Server query and procedural language, so you don’t have to switch database drivers or rewrite all of your application queries.
https://babelfishpg.org/
Apache License 2.0
274 stars 93 forks source link

Modify get_*_role_name() and get_*_schema_name() APIs to always return palloc'ed values #2866

Closed aswiniip closed 1 week ago

aswiniip commented 1 month ago

Description

Earlier in babelfish get__rolename() and get_schema_name() APIs returned constant values for a few cases. With this change we return Palloc'ed values instead of constant values.

Changes Made

In multidb.c, made changes to the APIs like get__rolename() and get_schema_name() to return palloc values instead of constant values.

Issues Resolved

Task: BABEL-4933

Test Scenarios Covered

Check List

Signed-off-by: P Aswini Kumar aswinii@amazon.com

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.

coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 10959115806

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contrib/babelfishpg_tsql/src/dbcmds.c 10 11 90.91%
contrib/babelfishpg_tsql/src/pl_exec.c 2 3 66.67%
contrib/babelfishpg_tsql/src/catalog.c 21 24 87.5%
contrib/babelfishpg_tsql/src/rolecmds.c 14 18 77.78%
contrib/babelfishpg_tsql/runtime/functions.c 14 20 70.0%
contrib/babelfishpg_tsql/src/multidb.c 32 40 80.0%
<!-- Total: 150 173 86.71% -->
Files with Coverage Reduction New Missed Lines %
contrib/babelfishpg_tsql/src/rolecmds.c 1 83.38%
contrib/babelfishpg_tsql/runtime/functions.c 3 83.26%
<!-- Total: 4 -->
Totals Coverage Status
Change from base Build 10958645688: 0.002%
Covered Lines: 44933
Relevant Lines: 60358

💛 - Coveralls
thephantomthief commented 2 weeks ago

Indentation is incorrect and new lines are missing at some places. Would be good to have these fixed. You can pgindent.

tanscorpio7 commented 1 week ago

Please update the description to include details about all the changes.

tanscorpio7 commented 1 week ago

Also in most places we are using suppress_role_error = true in

get_physical_user_name(char *db_name, char *user_name, bool suppress_db_error, bool suppress_role_error)

How do we decide when to use this flag suppress_role_error ?