@@ -103,6 +103,10 @@ static ExecutorFinish_hook_type PreviousExecutorFinishHook;
103
103
static ProcessUtility_hook_type PreviousProcessUtilityHook ;
104
104
static seq_nextval_hook_t PreviousSeqNextvalHook ;
105
105
106
+
107
+ /* Set given temp namespace in receiver */
108
+ PG_FUNCTION_INFO_V1 (mtm_set_temp_schema );
109
+
106
110
static void MtmSeqNextvalHook (Oid seqid , int64 next );
107
111
static void MtmExecutorStart (QueryDesc * queryDesc , int eflags );
108
112
static void MtmExecutorFinish (QueryDesc * queryDesc );
@@ -113,7 +117,7 @@ static void MtmProcessUtility(PlannedStmt *pstmt,
113
117
QueryEnvironment * queryEnv , DestReceiver * dest ,
114
118
char * completionTag );
115
119
116
- static void MtmProcessUtilityReciever (PlannedStmt * pstmt ,
120
+ static void MtmProcessUtilityReceiver (PlannedStmt * pstmt ,
117
121
const char * queryString ,
118
122
ProcessUtilityContext context , ParamListInfo params ,
119
123
QueryEnvironment * queryEnv , DestReceiver * dest ,
@@ -265,8 +269,6 @@ temp_schema_init(void)
265
269
}
266
270
}
267
271
268
- /* Set given temp namespace in receiver */
269
- PG_FUNCTION_INFO_V1 (mtm_set_temp_schema );
270
272
Datum
271
273
mtm_set_temp_schema (PG_FUNCTION_ARGS )
272
274
{
@@ -302,7 +304,6 @@ static void
302
304
MtmGucInit (void )
303
305
{
304
306
HASHCTL hash_ctl ;
305
- char * current_role ;
306
307
MemoryContext oldcontext ;
307
308
308
309
MemSet (& hash_ctl , 0 , sizeof (hash_ctl ));
@@ -321,7 +322,6 @@ MtmGucInit(void)
321
322
* XXX: try to avoid using MtmDatabaseUser somehow
322
323
*/
323
324
oldcontext = MemoryContextSwitchTo (TopMemoryContext );
324
- current_role = GetConfigOptionByName ("session_authorization" , NULL , false);
325
325
// XXX if (current_role && *current_role && strcmp(MtmDatabaseUser, current_role) != 0)
326
326
MtmGucUpdate ("session_authorization" );
327
327
MemoryContextSwitchTo (oldcontext );
@@ -606,7 +606,7 @@ MtmProcessUtility(PlannedStmt *pstmt, const char *queryString,
606
606
{
607
607
if (MtmIsLogicalReceiver )
608
608
{
609
- MtmProcessUtilityReciever (pstmt , queryString , context , params ,
609
+ MtmProcessUtilityReceiver (pstmt , queryString , context , params ,
610
610
queryEnv , dest , completionTag );
611
611
}
612
612
else
@@ -633,7 +633,7 @@ MtmProcessUtility(PlannedStmt *pstmt, const char *queryString,
633
633
* receiver (e.g calling DDL from trigger) this hook does nothing.
634
634
*/
635
635
static void
636
- MtmProcessUtilityReciever (PlannedStmt * pstmt , const char * queryString ,
636
+ MtmProcessUtilityReceiver (PlannedStmt * pstmt , const char * queryString ,
637
637
ProcessUtilityContext context , ParamListInfo params ,
638
638
QueryEnvironment * queryEnv , DestReceiver * dest ,
639
639
char * completionTag )
@@ -647,7 +647,7 @@ MtmProcessUtilityReciever(PlannedStmt *pstmt, const char *queryString,
647
647
bool captured = false;
648
648
649
649
mtm_log (DDLProcessingTrace ,
650
- "MtmProcessUtilityReciever : tag=%s, context=%d, issubtrans=%d, statement=%s" ,
650
+ "MtmProcessUtilityReceiver : tag=%s, context=%d, issubtrans=%d, statement=%s" ,
651
651
CreateCommandTag (parsetree ), context , IsSubTransaction (), queryString );
652
652
653
653
Assert (oldMemContext != MtmApplyContext );
@@ -883,7 +883,7 @@ MtmProcessUtilitySender(PlannedStmt *pstmt, const char *queryString,
883
883
{
884
884
DiscardStmt * stmt = (DiscardStmt * ) parsetree ;
885
885
886
- if (stmt -> type == DISCARD_TEMP )
886
+ if (stmt -> target == DISCARD_TEMP )
887
887
temp_schema_reset ();
888
888
889
889
if (!IsTransactionBlock () && stmt -> target == DISCARD_ALL )
@@ -1504,15 +1504,17 @@ MtmSeqNextvalHook(Oid seqid, int64 next)
1504
1504
static List *
1505
1505
AdjustCreateSequence (List * options )
1506
1506
{
1507
- bool has_increment = false, has_start = false;
1508
- ListCell * option ;
1507
+ bool has_increment = false;
1508
+ bool has_start = false;
1509
+ ListCell * option ;
1510
+ DefElem * defel ;
1509
1511
1510
1512
if (!MtmIsEnabled ())
1511
1513
return options ;
1512
1514
1513
1515
foreach (option , options )
1514
1516
{
1515
- DefElem * defel = (DefElem * ) lfirst (option );
1517
+ defel = (DefElem * ) lfirst (option );
1516
1518
if (strcmp (defel -> defname , "increment" ) == 0 )
1517
1519
has_increment = true;
1518
1520
else if (strcmp (defel -> defname , "start" ) == 0 )
@@ -1532,13 +1534,13 @@ AdjustCreateSequence(List *options)
1532
1534
max_node = mtm_cfg -> nodes [i ].node_id ;
1533
1535
}
1534
1536
1535
- DefElem * defel = makeDefElem ("increment" , (Node * ) makeInteger (max_node ), -1 );
1537
+ defel = makeDefElem ("increment" , (Node * ) makeInteger (max_node ), -1 );
1536
1538
options = lappend (options , defel );
1537
1539
}
1538
1540
1539
1541
if (!has_start )
1540
1542
{
1541
- DefElem * defel = makeDefElem ("start" , (Node * ) makeInteger (Mtm -> my_node_id ), -1 );
1543
+ defel = makeDefElem ("start" , (Node * ) makeInteger (Mtm -> my_node_id ), -1 );
1542
1544
options = lappend (options , defel );
1543
1545
}
1544
1546
0 commit comments