Skip to content

Commit

Permalink
Merge pull request #93 from amazon-aurora/jira-dbcreator
Browse files Browse the repository at this point in the history
Support dbcreator fixed server role #65
  • Loading branch information
anju15bharti authored Oct 25, 2024
2 parents 537c473 + da854b0 commit f5618f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/bin/pg_dump/dump_babel_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1175,10 +1175,14 @@ addFromClauseForPhysicalDatabaseDump(PQExpBuffer buf, TableInfo *tbinfo)
"WHERE a.rolname NOT IN %s",
fmtQualifiedDumpable(tbinfo), default_bbf_db_principals);
}
/*
* Do not dump sysadmin, bbf_role_admin, securityadmin,
* dbcreator and Babelfish initialize user
*/
else if(strcmp(tbinfo->dobj.name, "babelfish_authid_login_ext") == 0)
appendPQExpBuffer(buf, " FROM ONLY %s a "
"WHERE a.rolname NOT IN ('sysadmin', 'bbf_role_admin', "
"'securityadmin', '%s')", /* Do not dump sysadmin, bbf_role_admin, securityadmin and Babelfish initialize user */
"'securityadmin', 'dbcreator', '%s')",
fmtQualifiedDumpable(tbinfo), babel_init_user);
else if(strcmp(tbinfo->dobj.name, "babelfish_domain_mapping") == 0 ||
strcmp(tbinfo->dobj.name, "babelfish_function_ext") == 0 ||
Expand Down
5 changes: 3 additions & 2 deletions src/bin/pg_dump/dumpall_babel_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef enum {

static babelfish_status bbf_status = NONE;

static char default_bbf_roles[] = "('sysadmin', 'bbf_role_admin', 'securityadmin', "
static char default_bbf_roles[] = "('sysadmin', 'bbf_role_admin', 'securityadmin', 'dbcreator', "
"'master_dbo', 'master_db_owner', 'master_guest', 'master_db_accessadmin', 'master_db_datareader', 'master_db_datawriter', "
"'msdb_dbo', 'msdb_db_owner', 'msdb_guest', 'msdb_db_accessadmin', 'msdb_db_datareader', 'msdb_db_datawriter', "
"'tempdb_dbo', 'tempdb_db_owner', 'tempdb_guest', 'tempdb_db_accessadmin', 'tempdb_db_datareader', 'tempdb_db_datawriter')";
Expand Down Expand Up @@ -301,7 +301,8 @@ getBabelfishRoleMembershipQuery(PGconn *conn, PQExpBuffer buf,
appendPQExpBufferStr(buf,
"SELECT 'sysadmin' AS rolname UNION "
"SELECT 'bbf_role_admin' AS rolname UNION "
"SELECT 'securityadmin' AS rolname UNION ");
"SELECT 'securityadmin' AS rolname UNION "
"SELECT 'dbcreator' AS rolname UNION ");
appendPQExpBuffer(buf,
"SELECT rolname FROM sys.babelfish_authid_user_ext ");
/* Only dump users of the specific logical database we are currently dumping. */
Expand Down

0 comments on commit f5618f3

Please sign in to comment.