From dfce4ec7a5df1bc8a1667120efb7bcdb94a7d79a Mon Sep 17 00:00:00 2001 From: ANJU BHARTI Date: Thu, 12 Sep 2024 05:29:19 +0000 Subject: [PATCH 1/3] [Babelfish] Add securityadmin role in default_bbf_roles Signed-off-by: ANJU BHARTI --- src/bin/pg_dump/dumpall_babel_utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/pg_dump/dumpall_babel_utils.c b/src/bin/pg_dump/dumpall_babel_utils.c index 845867ad111..77865961492 100644 --- a/src/bin/pg_dump/dumpall_babel_utils.c +++ b/src/bin/pg_dump/dumpall_babel_utils.c @@ -35,7 +35,7 @@ typedef enum { static babelfish_status bbf_status = NONE; -static char default_bbf_roles[] = "('sysadmin', 'bbf_role_admin', " +static char default_bbf_roles[] = "('sysadmin', 'bbf_role_admin', 'securityadmin', " "'master_dbo', 'master_db_owner', 'master_guest', " "'msdb_dbo', 'msdb_db_owner', 'msdb_guest', " "'tempdb_dbo', 'tempdb_db_owner', 'tempdb_guest')"; @@ -300,7 +300,8 @@ getBabelfishRoleMembershipQuery(PGconn *conn, PQExpBuffer buf, else appendPQExpBufferStr(buf, "SELECT 'sysadmin' AS rolname UNION " - "SELECT 'bbf_role_admin' AS rolname UNION "); + "SELECT 'bbf_role_admin' AS rolname UNION " + "SELECT 'securityadmin' 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. */ From 7d1ab108a4779ec776ce6069a6195074890e5c76 Mon Sep 17 00:00:00 2001 From: ANJU BHARTI Date: Fri, 13 Sep 2024 06:28:09 +0000 Subject: [PATCH 2/3] Do not dump securityadmin catalog entry Signed-off-by: ANJU BHARTI --- src/bin/pg_dump/dump_babel_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_dump/dump_babel_utils.c b/src/bin/pg_dump/dump_babel_utils.c index 9d0a1968f3f..591a69c3032 100644 --- a/src/bin/pg_dump/dump_babel_utils.c +++ b/src/bin/pg_dump/dump_babel_utils.c @@ -1157,7 +1157,8 @@ addFromClauseForPhysicalDatabaseDump(PQExpBuffer buf, TableInfo *tbinfo) } 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', '%s')", /* Do not dump sysadmin, bbf_role_admin and Babelfish initialize user */ + "WHERE a.rolname NOT IN ('sysadmin', 'bbf_role_admin', " + "'securityadmin', '%s')", /* Do not dump sysadmin, bbf_role_admin, securityadmin and Babelfish initialize user */ fmtQualifiedDumpable(tbinfo), babel_init_user); else if(strcmp(tbinfo->dobj.name, "babelfish_domain_mapping") == 0 || strcmp(tbinfo->dobj.name, "babelfish_function_ext") == 0 || From bd6d0c7392af2aad8a2363d775ec005823bb60db Mon Sep 17 00:00:00 2001 From: ANJU BHARTI Date: Thu, 19 Sep 2024 10:59:41 +0000 Subject: [PATCH 3/3] Do not dump dbcreator catalog entry Signed-off-by: ANJU BHARTI --- src/bin/pg_dump/dump_babel_utils.c | 6 +++++- src/bin/pg_dump/dumpall_babel_utils.c | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/bin/pg_dump/dump_babel_utils.c b/src/bin/pg_dump/dump_babel_utils.c index 591a69c3032..ca256e9c3e0 100644 --- a/src/bin/pg_dump/dump_babel_utils.c +++ b/src/bin/pg_dump/dump_babel_utils.c @@ -1155,10 +1155,14 @@ addFromClauseForPhysicalDatabaseDump(PQExpBuffer buf, TableInfo *tbinfo) "'msdb_dbo', 'msdb_db_owner', 'msdb_guest')", fmtQualifiedDumpable(tbinfo)); } + /* + * 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 || diff --git a/src/bin/pg_dump/dumpall_babel_utils.c b/src/bin/pg_dump/dumpall_babel_utils.c index 77865961492..f9a69a4c6cc 100644 --- a/src/bin/pg_dump/dumpall_babel_utils.c +++ b/src/bin/pg_dump/dumpall_babel_utils.c @@ -35,7 +35,8 @@ 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', " "'msdb_dbo', 'msdb_db_owner', 'msdb_guest', " "'tempdb_dbo', 'tempdb_db_owner', 'tempdb_guest')"; @@ -301,7 +302,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. */