Skip to content

Commit

Permalink
New line indentation fix
Browse files Browse the repository at this point in the history
Signed-off-by: P Aswini Kumar <[email protected]>
  • Loading branch information
P Aswini Kumar committed Sep 20, 2024
1 parent fcba610 commit b6485a5
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 2 deletions.
9 changes: 9 additions & 0 deletions contrib/babelfishpg_tsql/runtime/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1310,8 +1310,10 @@ schema_id(PG_FUNCTION_ARGS)
if (!user)
{
pfree(db_name);

if(guest_role_name)
pfree(guest_role_name);

PG_RETURN_NULL();
}
else if ((guest_role_name && strcmp(user, guest_role_name) == 0))
Expand All @@ -1324,6 +1326,7 @@ schema_id(PG_FUNCTION_ARGS)
physical_name = get_physical_schema_name(db_name, name);
}
pfree(db_name);

if(guest_role_name)
pfree(guest_role_name);
}
Expand Down Expand Up @@ -2233,10 +2236,12 @@ object_id(PG_FUNCTION_ARGS)
pfree(db_name);
pfree(schema_name);
pfree(object_name);

if(guest_role_name)
pfree(guest_role_name);
if (object_type)
pfree(object_type);

PG_RETURN_NULL();
}
else if ((guest_role_name && strcmp(user, guest_role_name) == 0))
Expand All @@ -2249,6 +2254,7 @@ object_id(PG_FUNCTION_ARGS)
schema_name = get_authid_user_ext_schema_name((const char *) db_name, user);
physical_schema_name = get_physical_schema_name(db_name, schema_name);
}

if(guest_role_name)
pfree(guest_role_name);
}
Expand Down Expand Up @@ -2691,8 +2697,10 @@ type_id(PG_FUNCTION_ARGS)
pfree(db_name);
pfree(schema_name);
pfree(object_name);

if(guest_role_name)
pfree(guest_role_name);

PG_RETURN_NULL();
}
else if ((guest_role_name && strcmp(user, guest_role_name) == 0))
Expand All @@ -2705,6 +2713,7 @@ type_id(PG_FUNCTION_ARGS)
schema_name = get_authid_user_ext_schema_name((const char *) db_name, user);
physical_schema_name = get_physical_schema_name(db_name, schema_name);
}

if(guest_role_name)
pfree(guest_role_name);
}
Expand Down
5 changes: 3 additions & 2 deletions contrib/babelfishpg_tsql/src/catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -3220,6 +3220,7 @@ create_guest_role_for_db(const char *dbname)
SetConfigOption("createrole_self_grant", old_createrole_self_grant, PGC_USERSET, PGC_S_OVERRIDE);
SetUserIdAndSecContext(save_userid, save_sec_context);
set_cur_db(old_dbid, old_dbname);

if(guest)
pfree(guest);
}
Expand Down Expand Up @@ -5008,8 +5009,8 @@ rename_tsql_db(char *old_db_name, char *new_db_name)

/*
* user_exists_for_db
* returns true if the user/role exists in the sys.babelfish_authid_user_ext catalog,
* false otherwise.
* returns true if the user/role exists in the sys.babelfish_authid_user_ext catalog,
* false otherwise.
*/
bool
user_exists_for_db(const char *db_name, const char *user_name)
Expand Down
2 changes: 2 additions & 0 deletions contrib/babelfishpg_tsql/src/dbcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ create_bbf_db_internal(ParseState *pstate, const char *dbname, List *options, co
add_to_bbf_authid_user_ext(guest, "guest", dbname, "guest", NULL, false, true, false);
else
add_to_bbf_authid_user_ext(guest, "guest", dbname, "guest", NULL, false, false, false);

pfree(guest);
}
}
Expand All @@ -647,6 +648,7 @@ create_bbf_db_internal(ParseState *pstate, const char *dbname, List *options, co
SetConfigOption("createrole_self_grant", old_createrole_self_grant, PGC_USERSET, PGC_S_OVERRIDE);
SetUserIdAndSecContext(save_userid, save_sec_context);
set_cur_db(old_dbid, old_dbname);

if(dbo_scm)
pfree(dbo_scm);
if(guest_scm)
Expand Down
1 change: 1 addition & 0 deletions contrib/babelfishpg_tsql/src/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -4949,6 +4949,7 @@ get_local_schema_for_bbf_functions(Oid proc_nsp_oid)
quote_identifier(func_dbo_schema));

ReleaseSysCache(tuple);

if(func_dbo_schema)
pfree(func_dbo_schema);
}
Expand Down
2 changes: 2 additions & 0 deletions contrib/babelfishpg_tsql/src/pl_exec-2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3347,6 +3347,7 @@ void exec_stmt_dbcc_checkident(PLtsql_stmt_dbcc *stmt)
}
}
pfree(db_name);

if(guest_role_name)
pfree(guest_role_name);
if(dbo_role_name)
Expand Down Expand Up @@ -3404,6 +3405,7 @@ void exec_stmt_dbcc_checkident(PLtsql_stmt_dbcc *stmt)
errmsg("'%s.%s' does not contain an identity column.",
nsp_name, dbcc_stmt.table_name)));
}

if(nsp_name)
pfree(nsp_name);

Expand Down
2 changes: 2 additions & 0 deletions contrib/babelfishpg_tsql/src/pl_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -10401,8 +10401,10 @@ reset_search_path(PLtsql_stmt_execsql *stmt, char **old_search_path, bool *reset
}

pfree(cur_dbname);

if(dbo_schema)
pfree(dbo_schema);

return false;
}

Expand Down
3 changes: 3 additions & 0 deletions contrib/babelfishpg_tsql/src/pl_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -3283,6 +3283,7 @@ bbf_ProcessUtility(PlannedStmt *pstmt,
set_session_properties(db_name);
pfree(cur_user);
pfree(db_name);

if(dbo_name)
pfree(dbo_name);

Expand Down Expand Up @@ -3409,8 +3410,10 @@ bbf_ProcessUtility(PlannedStmt *pstmt,
}

pfree(rolspec->rolename);

if(db_owner_name)
pfree(db_owner_name);

rolspec->rolename = user_name;
}
}
Expand Down
1 change: 1 addition & 0 deletions contrib/babelfishpg_tsql/src/procedures.c
Original file line number Diff line number Diff line change
Expand Up @@ -3381,6 +3381,7 @@ sp_babelfish_volatility(PG_FUNCTION_ARGS)
physical_schema_name = get_physical_schema_name(db_name, logical_schema_name);
pfree(logical_schema_name);
}

if(guest_role_name)
pfree(guest_role_name);
}
Expand Down
2 changes: 2 additions & 0 deletions contrib/babelfishpg_tsql/src/rolecmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ grant_revoke_dbo_to_login(const char* login, const char* db_name, bool is_grant)
CommandCounterIncrement();

pfree(query.data);

if(dbo_role_name)
pfree(dbo_role_name);
}
Expand Down Expand Up @@ -1377,6 +1378,7 @@ add_existing_users_to_catalog(PG_FUNCTION_ARGS)
add_to_bbf_authid_user_ext(guest, "guest", db_name, NULL, NULL, false, true, false);
else
add_to_bbf_authid_user_ext(guest, "guest", db_name, NULL, NULL, false, false, false);

pfree(guest);
}

Expand Down

0 comments on commit b6485a5

Please sign in to comment.