@@ -2245,8 +2245,23 @@ MtmNoticeReceiver(void *i, const PGresult *res)
22452245
22462246 stripped_notice = palloc0 (len );
22472247
2248- /* Strip "NOTICE: " from beginning and "\n" from end of error string */
2249- strncpy (stripped_notice , notice + 9 , len - 1 - 9 );
2248+ if (* notice == 'N' )
2249+ {
2250+ /* Strip "NOTICE: " from beginning and "\n" from end of error string */
2251+ strncpy (stripped_notice , notice + 9 , len - 1 - 9 );
2252+ elog (NOTICE , "%s" , stripped_notice );
2253+ }
2254+ else if (* notice == 'W' )
2255+ {
2256+ /* Strip "WARNING: " from beginning and "\n" from end of error string */
2257+ strncpy (stripped_notice , notice + 10 , len - 1 - 10 );
2258+ elog (WARNING , "%s" , stripped_notice );
2259+ }
2260+ else
2261+ {
2262+ stripped_notice = notice ;
2263+ elog (WARNING , "%s" , stripped_notice );
2264+ }
22502265
22512266 MTM_LOG1 ("%s" , stripped_notice );
22522267 pfree (stripped_notice );
@@ -2478,41 +2493,45 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24782493 case T_PrepareStmt :
24792494 case T_ExecuteStmt :
24802495 case T_DeallocateStmt :
2481- //case T_GrantStmt: /* XXX: we could replicate some of these these */;
2482- //case T_GrantRoleStmt:
2483- //case T_AlterDatabaseStmt:
2484- //case T_AlterDatabaseSetStmt:
24852496 case T_NotifyStmt :
24862497 case T_ListenStmt :
24872498 case T_UnlistenStmt :
24882499 case T_LoadStmt :
24892500 case T_ClusterStmt : /* XXX: we could replicate these */ ;
24902501 case T_VacuumStmt :
24912502 case T_ExplainStmt :
2492- //case T_AlterSystemStmt:
24932503 case T_VariableShowStmt :
2494- case T_DiscardStmt :
2495- //case T_CreateEventTrigStmt:
2496- //case T_AlterEventTrigStmt:
2497- //case T_CreateRoleStmt:
2498- //case T_AlterRoleStmt:
2499- //case T_AlterRoleSetStmt:
2500- //case T_DropRoleStmt:
25012504 case T_ReassignOwnedStmt :
25022505 case T_LockStmt :
2503- //case T_ConstraintsSetStmt:
25042506 case T_CheckPointStmt :
25052507 case T_ReindexStmt :
25062508 skipCommand = true;
25072509 break ;
2510+ case T_DiscardStmt :
2511+ {
2512+ //DiscardStmt *stmt = (DiscardStmt *) parsetree;
2513+ //skipCommand = stmt->target == DISCARD_TEMP;
2514+
2515+ skipCommand = true;
2516+
2517+ if (MtmGUCBufferAllocated )
2518+ {
2519+ // XXX: move allocation somewhere to backend startup and check
2520+ // where buffer is empty in send routines.
2521+ MtmGUCBufferAllocated = false;
2522+ pfree (MtmGUCBuffer );
2523+ }
2524+
2525+ }
2526+ break ;
25082527 case T_VariableSetStmt :
25092528 {
25102529 VariableSetStmt * stmt = (VariableSetStmt * ) parsetree ;
25112530
25122531 skipCommand = true;
25132532
25142533 /* Prevent SET TRANSACTION from replication */
2515- if (MtmTx . isTransactionBlock || stmt -> kind == VAR_SET_MULTI )
2534+ if (stmt -> kind == VAR_SET_MULTI )
25162535 break ;
25172536
25182537 if (!MtmGUCBufferAllocated )
@@ -2525,13 +2544,10 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
25252544 MtmGUCBufferAllocated = true;
25262545 }
25272546
2528- //appendStringInfoString(MtmGUCBuffer, "SET ");
2529- //appendStringInfoString(MtmGUCBuffer, stmt->name);
2530- //appendStringInfoString(MtmGUCBuffer, " TO ");
2531- //appendStringInfoString(MtmGUCBuffer, ExtractSetVariableArgs(stmt));
2532- //appendStringInfoString(MtmGUCBuffer, "; ");
2533-
25342547 appendStringInfoString (MtmGUCBuffer , queryString );
2548+
2549+ // sometimes there is no ';' char at the end.
2550+ appendStringInfoString (MtmGUCBuffer , ";" );
25352551 }
25362552 break ;
25372553 case T_CreateStmt :
0 commit comments