Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c45303d

Browse files
committed
allocate session_authorization role in TopMemoryContext
1 parent 68abec2 commit c45303d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

multimaster.c

+3
Original file line numberDiff line numberDiff line change
@@ -4493,6 +4493,7 @@ static void MtmGucInit(void)
44934493
{
44944494
HASHCTL hash_ctl;
44954495
char *current_role;
4496+
MemoryContext oldcontext;
44964497

44974498
MemSet(&hash_ctl, 0, sizeof(hash_ctl));
44984499
hash_ctl.keysize = GUC_KEY_MAXLEN;
@@ -4507,9 +4508,11 @@ static void MtmGucInit(void)
45074508
* If current role is not equal to MtmDatabaseUser, than set it bofore
45084509
* any other GUC vars.
45094510
*/
4511+
oldcontext = MemoryContextSwitchTo(TopMemoryContext);
45104512
current_role = GetConfigOptionByName("session_authorization", NULL, false);
45114513
if (strcmp(MtmDatabaseUser, current_role) != 0)
45124514
MtmGucUpdate("session_authorization", current_role);
4515+
MemoryContextSwitchTo(oldcontext);
45134516
}
45144517

45154518
static void MtmGucDiscard()

sql/multimaster.sql

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ alter schema user1 owner to user1;
44

55
\c "user=user1 dbname=regression"
66
create table user1.test(i int primary key);
7+
create table user1.test2(i int primary key);
78

89
\c "user=user1 dbname=regression port=5433"
910
select * from test;

0 commit comments

Comments
 (0)