@@ -2227,10 +2227,24 @@ MtmNoticeReceiver(void *i, const PGresult *res)
2227
2227
2228
2228
stripped_notice = palloc0 (len );
2229
2229
2230
- /* Strip "NOTICE: " from beginning and "\n" from end of error string */
2231
- strncpy (stripped_notice , notice + 9 , len - 1 - 9 );
2230
+ if (* notice == 'N' )
2231
+ {
2232
+ /* Strip "NOTICE: " from beginning and "\n" from end of error string */
2233
+ strncpy (stripped_notice , notice + 9 , len - 1 - 9 );
2234
+ elog (NOTICE , "%s" , stripped_notice );
2235
+ }
2236
+ else if (* notice == 'W' )
2237
+ {
2238
+ /* Strip "WARNING: " from beginning and "\n" from end of error string */
2239
+ strncpy (stripped_notice , notice + 10 , len - 1 - 10 );
2240
+ elog (WARNING , "%s" , stripped_notice );
2241
+ }
2242
+ else
2243
+ {
2244
+ stripped_notice = notice ;
2245
+ elog (WARNING , "%s" , stripped_notice );
2246
+ }
2232
2247
2233
- elog (NOTICE , "%s" , stripped_notice );
2234
2248
pfree (stripped_notice );
2235
2249
}
2236
2250
@@ -2461,41 +2475,45 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2461
2475
case T_PrepareStmt :
2462
2476
case T_ExecuteStmt :
2463
2477
case T_DeallocateStmt :
2464
- //case T_GrantStmt: /* XXX: we could replicate some of these these */;
2465
- //case T_GrantRoleStmt:
2466
- //case T_AlterDatabaseStmt:
2467
- //case T_AlterDatabaseSetStmt:
2468
2478
case T_NotifyStmt :
2469
2479
case T_ListenStmt :
2470
2480
case T_UnlistenStmt :
2471
2481
case T_LoadStmt :
2472
2482
case T_ClusterStmt : /* XXX: we could replicate these */ ;
2473
2483
case T_VacuumStmt :
2474
2484
case T_ExplainStmt :
2475
- //case T_AlterSystemStmt:
2476
2485
case T_VariableShowStmt :
2477
- case T_DiscardStmt :
2478
- //case T_CreateEventTrigStmt:
2479
- //case T_AlterEventTrigStmt:
2480
- //case T_CreateRoleStmt:
2481
- //case T_AlterRoleStmt:
2482
- //case T_AlterRoleSetStmt:
2483
- //case T_DropRoleStmt:
2484
2486
case T_ReassignOwnedStmt :
2485
2487
case T_LockStmt :
2486
- //case T_ConstraintsSetStmt:
2487
2488
case T_CheckPointStmt :
2488
2489
case T_ReindexStmt :
2489
2490
skipCommand = true;
2490
2491
break ;
2492
+ case T_DiscardStmt :
2493
+ {
2494
+ //DiscardStmt *stmt = (DiscardStmt *) parsetree;
2495
+ //skipCommand = stmt->target == DISCARD_TEMP;
2496
+
2497
+ skipCommand = true;
2498
+
2499
+ if (MtmGUCBufferAllocated )
2500
+ {
2501
+ // XXX: move allocation somewhere to backend startup and check
2502
+ // where buffer is empty in send routines.
2503
+ MtmGUCBufferAllocated = false;
2504
+ pfree (MtmGUCBuffer );
2505
+ }
2506
+
2507
+ }
2508
+ break ;
2491
2509
case T_VariableSetStmt :
2492
2510
{
2493
2511
VariableSetStmt * stmt = (VariableSetStmt * ) parsetree ;
2494
2512
2495
2513
skipCommand = true;
2496
2514
2497
2515
/* Prevent SET TRANSACTION from replication */
2498
- if (MtmTx . isTransactionBlock || stmt -> kind == VAR_SET_MULTI )
2516
+ if (stmt -> kind == VAR_SET_MULTI )
2499
2517
break ;
2500
2518
2501
2519
if (!MtmGUCBufferAllocated )
@@ -2508,13 +2526,10 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2508
2526
MtmGUCBufferAllocated = true;
2509
2527
}
2510
2528
2511
- //appendStringInfoString(MtmGUCBuffer, "SET ");
2512
- //appendStringInfoString(MtmGUCBuffer, stmt->name);
2513
- //appendStringInfoString(MtmGUCBuffer, " TO ");
2514
- //appendStringInfoString(MtmGUCBuffer, ExtractSetVariableArgs(stmt));
2515
- //appendStringInfoString(MtmGUCBuffer, "; ");
2516
-
2517
2529
appendStringInfoString (MtmGUCBuffer , queryString );
2530
+
2531
+ // sometimes there is no ';' char at the end.
2532
+ appendStringInfoString (MtmGUCBuffer , ";" );
2518
2533
}
2519
2534
break ;
2520
2535
case T_CreateStmt :
0 commit comments