From 04d2e9fb2f2e3fb89cc27ff43ae6e1354d67bc8a Mon Sep 17 00:00:00 2001 From: gindibay Date: Mon, 18 Sep 2023 22:23:26 +0300 Subject: [PATCH] Fixes review comments --- .../distributed/deparser/deparse_role_stmts.c | 19 +++++++++++++------ .../expected/alter_role_propagation.out | 2 +- .../regress/sql/alter_role_propagation.sql | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/backend/distributed/deparser/deparse_role_stmts.c b/src/backend/distributed/deparser/deparse_role_stmts.c index 0a66023c0..45b0990a0 100644 --- a/src/backend/distributed/deparser/deparse_role_stmts.c +++ b/src/backend/distributed/deparser/deparse_role_stmts.c @@ -164,10 +164,6 @@ AppendRoleOption(StringInfo buf, ListCell *optionCell) { appendStringInfo(buf, " CONNECTION LIMIT %d", intVal(option->arg)); } - else if (strcmp(option->defname, "sysid") == 0) - { - appendStringInfo(buf, " SYSID %d", intVal(option->arg)); - } else if (strcmp(option->defname, "password") == 0) { if (option->arg != NULL) @@ -204,10 +200,20 @@ DeparseCreateRoleStmt(Node *node) return buf.data; } +static void +AppendSysIdStatement(StringInfo buf, ListCell *optionCell) +{ + DefElem *option = (DefElem *) lfirst(optionCell); + if (strcmp(option->defname, "sysid") == 0) + { + appendStringInfo(buf, " SYSID %d", intVal(option->arg)); + } +} + /* - * AppendRoleOption generates the string representation of the DefElem option - * and appends it to the buffer. + * AppendInlinePriviliges generates the string representation for the inline + * privileges of the role in create statement and appends it to the buffer. */ static void AppendInlinePriviliges(StringInfo buf, ListCell *optionCell) @@ -277,6 +283,7 @@ AppendCreateRoleStmt(StringInfo buf, CreateRoleStmt *stmt) { AppendRoleOption(buf, optionCell); AppendInlinePriviliges(buf, optionCell); + AppendSysIdStatement(buf, optionCell); } } diff --git a/src/test/regress/expected/alter_role_propagation.out b/src/test/regress/expected/alter_role_propagation.out index 4c9420796..82310f477 100644 --- a/src/test/regress/expected/alter_role_propagation.out +++ b/src/test/regress/expected/alter_role_propagation.out @@ -405,7 +405,7 @@ NOTICE: issuing ALTER ROLE test1 RENAME TO test2; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx NOTICE: issuing ALTER ROLE test1 RENAME TO test2; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -drop user if exists test2; +drop user test2; SET citus.log_remote_commands = false; DROP TABLE test_search_path; DROP SCHEMA alter_role, ",CitUs,.TeeN!?", test_sp CASCADE; diff --git a/src/test/regress/sql/alter_role_propagation.sql b/src/test/regress/sql/alter_role_propagation.sql index d077b1bc7..658b42e3d 100644 --- a/src/test/regress/sql/alter_role_propagation.sql +++ b/src/test/regress/sql/alter_role_propagation.sql @@ -146,7 +146,7 @@ ALTER USER test1 SET random_page_cost TO 1.5; alter user test1 rename to test2; -drop user if exists test2; +drop user test2; SET citus.log_remote_commands = false;