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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy