@@ -2227,10 +2227,24 @@ MtmNoticeReceiver(void *i, const PGresult *res)
22272227
22282228 stripped_notice = palloc0 (len );
22292229
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+ }
22322247
2233- elog (NOTICE , "%s" , stripped_notice );
22342248 pfree (stripped_notice );
22352249}
22362250
@@ -2461,41 +2475,45 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24612475 case T_PrepareStmt :
24622476 case T_ExecuteStmt :
24632477 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:
24682478 case T_NotifyStmt :
24692479 case T_ListenStmt :
24702480 case T_UnlistenStmt :
24712481 case T_LoadStmt :
24722482 case T_ClusterStmt : /* XXX: we could replicate these */ ;
24732483 case T_VacuumStmt :
24742484 case T_ExplainStmt :
2475- //case T_AlterSystemStmt:
24762485 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:
24842486 case T_ReassignOwnedStmt :
24852487 case T_LockStmt :
2486- //case T_ConstraintsSetStmt:
24872488 case T_CheckPointStmt :
24882489 case T_ReindexStmt :
24892490 skipCommand = true;
24902491 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 ;
24912509 case T_VariableSetStmt :
24922510 {
24932511 VariableSetStmt * stmt = (VariableSetStmt * ) parsetree ;
24942512
24952513 skipCommand = true;
24962514
24972515 /* Prevent SET TRANSACTION from replication */
2498- if (MtmTx . isTransactionBlock || stmt -> kind == VAR_SET_MULTI )
2516+ if (stmt -> kind == VAR_SET_MULTI )
24992517 break ;
25002518
25012519 if (!MtmGUCBufferAllocated )
@@ -2508,13 +2526,10 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
25082526 MtmGUCBufferAllocated = true;
25092527 }
25102528
2511- //appendStringInfoString(MtmGUCBuffer, "SET ");
2512- //appendStringInfoString(MtmGUCBuffer, stmt->name);
2513- //appendStringInfoString(MtmGUCBuffer, " TO ");
2514- //appendStringInfoString(MtmGUCBuffer, ExtractSetVariableArgs(stmt));
2515- //appendStringInfoString(MtmGUCBuffer, "; ");
2516-
25172529 appendStringInfoString (MtmGUCBuffer , queryString );
2530+
2531+ // sometimes there is no ';' char at the end.
2532+ appendStringInfoString (MtmGUCBuffer , ";" );
25182533 }
25192534 break ;
25202535 case T_CreateStmt :
0 commit comments