diff --git a/pgxn/neon/control_plane_connector.c b/pgxn/neon/control_plane_connector.c index 82e4af4b4a..debbbce117 100644 --- a/pgxn/neon/control_plane_connector.c +++ b/pgxn/neon/control_plane_connector.c @@ -32,6 +32,7 @@ #include "port.h" #include #include "utils/jsonb.h" +#include "libpq/crypt.h" static ProcessUtility_hook_type PreviousProcessUtilityHook = NULL; @@ -161,7 +162,22 @@ ConstructDeltaMessage() PushKeyValue(&state, "name", entry->name); if (entry->password) { +#if PG_MAJORVERSION_NUM == 14 + char *logdetail; +#else + const char *logdetail; +#endif PushKeyValue(&state, "password", (char *) entry->password); + char *encrypted_password = get_role_password(entry->name, &logdetail); + + if (encrypted_password) + { + PushKeyValue(&state, "encrypted_password", encrypted_password); + } + else + { + elog(ERROR, "Failed to get encrypted password: %s", logdetail); + } } if (entry->old_name[0] != '\0') { diff --git a/test_runner/regress/test_ddl_forwarding.py b/test_runner/regress/test_ddl_forwarding.py index 6bfa8fdbe7..ebd836ecbc 100644 --- a/test_runner/regress/test_ddl_forwarding.py +++ b/test_runner/regress/test_ddl_forwarding.py @@ -33,6 +33,7 @@ def handle_role(dbs, roles, operation): dbs[db] = operation["name"] if "password" in operation: roles[operation["name"]] = operation["password"] + assert "encrypted_password" in operation elif operation["op"] == "del": if "old_name" in operation: roles.pop(operation["old_name"])