@@ -2244,10 +2244,24 @@ MtmNoticeReceiver(void *i, const PGresult *res)
2244
2244
2245
2245
stripped_notice = palloc0 (len );
2246
2246
2247
- /* Strip "NOTICE: " from beginning and "\n" from end of error string */
2248
- strncpy (stripped_notice , notice + 9 , len - 1 - 9 );
2247
+ if (* notice == 'N' )
2248
+ {
2249
+ /* Strip "NOTICE: " from beginning and "\n" from end of error string */
2250
+ strncpy (stripped_notice , notice + 9 , len - 1 - 9 );
2251
+ elog (NOTICE , "%s" , stripped_notice );
2252
+ }
2253
+ else if (* notice == 'W' )
2254
+ {
2255
+ /* Strip "WARNING: " from beginning and "\n" from end of error string */
2256
+ strncpy (stripped_notice , notice + 10 , len - 1 - 10 );
2257
+ elog (WARNING , "%s" , stripped_notice );
2258
+ }
2259
+ else
2260
+ {
2261
+ stripped_notice = notice ;
2262
+ elog (WARNING , "%s" , stripped_notice );
2263
+ }
2249
2264
2250
- MTM_LOG1 ("%s" , stripped_notice );
2251
2265
pfree (stripped_notice );
2252
2266
}
2253
2267
@@ -2473,41 +2487,45 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2473
2487
case T_PrepareStmt :
2474
2488
case T_ExecuteStmt :
2475
2489
case T_DeallocateStmt :
2476
- //case T_GrantStmt: /* XXX: we could replicate some of these these */;
2477
- //case T_GrantRoleStmt:
2478
- //case T_AlterDatabaseStmt:
2479
- //case T_AlterDatabaseSetStmt:
2480
2490
case T_NotifyStmt :
2481
2491
case T_ListenStmt :
2482
2492
case T_UnlistenStmt :
2483
2493
case T_LoadStmt :
2484
2494
case T_ClusterStmt : /* XXX: we could replicate these */ ;
2485
2495
case T_VacuumStmt :
2486
2496
case T_ExplainStmt :
2487
- //case T_AlterSystemStmt:
2488
2497
case T_VariableShowStmt :
2489
- case T_DiscardStmt :
2490
- //case T_CreateEventTrigStmt:
2491
- //case T_AlterEventTrigStmt:
2492
- //case T_CreateRoleStmt:
2493
- //case T_AlterRoleStmt:
2494
- //case T_AlterRoleSetStmt:
2495
- //case T_DropRoleStmt:
2496
2498
case T_ReassignOwnedStmt :
2497
2499
case T_LockStmt :
2498
- //case T_ConstraintsSetStmt:
2499
2500
case T_CheckPointStmt :
2500
2501
case T_ReindexStmt :
2501
2502
skipCommand = true;
2502
2503
break ;
2504
+ case T_DiscardStmt :
2505
+ {
2506
+ //DiscardStmt *stmt = (DiscardStmt *) parsetree;
2507
+ //skipCommand = stmt->target == DISCARD_TEMP;
2508
+
2509
+ skipCommand = true;
2510
+
2511
+ if (MtmGUCBufferAllocated )
2512
+ {
2513
+ // XXX: move allocation somewhere to backend startup and check
2514
+ // where buffer is empty in send routines.
2515
+ MtmGUCBufferAllocated = false;
2516
+ pfree (MtmGUCBuffer );
2517
+ }
2518
+
2519
+ }
2520
+ break ;
2503
2521
case T_VariableSetStmt :
2504
2522
{
2505
2523
VariableSetStmt * stmt = (VariableSetStmt * ) parsetree ;
2506
2524
2507
2525
skipCommand = true;
2508
2526
2509
2527
/* Prevent SET TRANSACTION from replication */
2510
- if (MtmTx . isTransactionBlock || stmt -> kind == VAR_SET_MULTI )
2528
+ if (stmt -> kind == VAR_SET_MULTI )
2511
2529
break ;
2512
2530
2513
2531
if (!MtmGUCBufferAllocated )
@@ -2520,13 +2538,10 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2520
2538
MtmGUCBufferAllocated = true;
2521
2539
}
2522
2540
2523
- //appendStringInfoString(MtmGUCBuffer, "SET ");
2524
- //appendStringInfoString(MtmGUCBuffer, stmt->name);
2525
- //appendStringInfoString(MtmGUCBuffer, " TO ");
2526
- //appendStringInfoString(MtmGUCBuffer, ExtractSetVariableArgs(stmt));
2527
- //appendStringInfoString(MtmGUCBuffer, "; ");
2528
-
2529
2541
appendStringInfoString (MtmGUCBuffer , queryString );
2542
+
2543
+ // sometimes there is no ';' char at the end.
2544
+ appendStringInfoString (MtmGUCBuffer , ";" );
2530
2545
}
2531
2546
break ;
2532
2547
case T_CreateStmt :
0 commit comments