Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Tanzeel Khan <[email protected]>
  • Loading branch information
tanscorpio7 committed Sep 23, 2024
1 parent 7328656 commit ab1a48d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/babelfishpg_tsql/src/dbcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ create_database_roles_for_all_dbs(PG_FUNCTION_ARGS)
int saved_nest_level = 0;

/* We only allow this to be called from an extension's SQL script. */
if (!creating_extension)
if (creating_extension)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("%s can only be called from an SQL script executed by CREATE/ALTER EXTENSION",
Expand Down Expand Up @@ -1296,6 +1296,7 @@ create_database_roles_for_all_dbs(PG_FUNCTION_ARGS)
*/
SetUserIdAndSecContext(get_bbf_role_admin_oid(), save_sec_context | SECURITY_LOCAL_USERID_CHANGE);
SetConfigOption("createrole_self_grant", "inherit", PGC_USERSET, PGC_S_OVERRIDE);
add_to_bbf_authid_user_ext(db_accessadmin, DB_ACCESSADMIN, dbname, NULL, NULL, true, true, false);
/* Run all subcommands */
foreach(parsetree_item, parsetree_list)
{
Expand All @@ -1320,7 +1321,6 @@ create_database_roles_for_all_dbs(PG_FUNCTION_ARGS)

CommandCounterIncrement();
}
add_to_bbf_authid_user_ext(db_accessadmin, DB_ACCESSADMIN, dbname, NULL, NULL, true, true, false);
}
PG_FINALLY();
{
Expand Down

0 comments on commit ab1a48d

Please sign in to comment.