File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -4487,10 +4487,12 @@ typedef struct MtmGucEntry
4487
4487
4488
4488
static HTAB * MtmGucHash = NULL ;
4489
4489
static dlist_head MtmGucList = DLIST_STATIC_INIT (MtmGucList );
4490
+ static inline void MtmGucUpdate (const char * key , char * value );
4490
4491
4491
4492
static void MtmGucInit (void )
4492
4493
{
4493
4494
HASHCTL hash_ctl ;
4495
+ char * current_role ;
4494
4496
4495
4497
MemSet (& hash_ctl , 0 , sizeof (hash_ctl ));
4496
4498
hash_ctl .keysize = GUC_KEY_MAXLEN ;
@@ -4500,6 +4502,14 @@ static void MtmGucInit(void)
4500
4502
MTM_GUC_HASHSIZE ,
4501
4503
& hash_ctl ,
4502
4504
HASH_ELEM | HASH_CONTEXT );
4505
+
4506
+ /*
4507
+ * If current role is not equal to MtmDatabaseUser, than set it bofore
4508
+ * any other GUC vars.
4509
+ */
4510
+ current_role = GetConfigOptionByName ("session_authorization" , NULL , false);
4511
+ if (strcmp (MtmDatabaseUser , current_role ) != 0 )
4512
+ MtmGucUpdate ("session_authorization" , current_role );
4503
4513
}
4504
4514
4505
4515
static void MtmGucDiscard ()
@@ -4593,6 +4603,9 @@ char* MtmGucSerialize(void)
4593
4603
dlist_iter iter ;
4594
4604
int nvars = 0 ;
4595
4605
4606
+ if (!MtmGucHash )
4607
+ MtmGucInit ();
4608
+
4596
4609
serialized_gucs = makeStringInfo ();
4597
4610
4598
4611
dlist_foreach (iter , & MtmGucList )
Original file line number Diff line number Diff line change
1
+ create user user1 ;
2
+ create schema user1 ;
3
+ alter schema user1 owner to user1;
4
+
5
+ \c " user=user1 dbname=regression"
6
+ create table user1 .test(i int primary key );
7
+
8
+ \c " user=user1 dbname=regression port=5433"
9
+ select * from test;
10
+
You can’t perform that action at this time.
0 commit comments