update src/common/backend/utils/init/miscinit.cpp.

This commit is contained in:
maxiang 2021-08-06 02:51:43 +00:00 committed by Gitee
parent e929c3d736
commit 8b911a9ecc
1 changed files with 1 additions and 2 deletions

View File

@ -802,8 +802,7 @@ void InitializeSessionUserId(const char* rolename)
char userName[NAMEDATALEN];
MemoryContext oldcontext = NULL;
oldcontext = MemoryContextSwitchTo(SESS_GET_MEM_CXT_GROUP(MEMORY_CONTEXT_EXECUTOR));
if (u_sess->proc_cxt.MyProcPort->user_name)
pfree_ext(u_sess->proc_cxt.MyProcPort->user_name);
pfree_ext(u_sess->proc_cxt.MyProcPort->user_name);
u_sess->proc_cxt.MyProcPort->user_name = pstrdup((char*)GetSuperUserName((char*)userName));
(void)MemoryContextSwitchTo(oldcontext);
rolename = u_sess->proc_cxt.MyProcPort->user_name;