@@ -2158,14 +2158,33 @@ static bool MtmRunUtilityStmt(PGconn* conn, char const* sql, char **errmsg)
21582158
21592159* errmsg = palloc0 (errlen );
21602160
2161- /* Strip "ERROR:\t " from beginning and "\n" from end of error string */
2161+ /* Strip "ERROR: " from beginning and "\n" from end of error string */
21622162strncpy (* errmsg ,errstr + 8 ,errlen - 1 - 8 );
21632163}
21642164
21652165PQclear (result );
21662166return ret ;
21672167}
21682168
2169+ void MtmNoticeReceiver (void * i ,const PGresult * res )
2170+ {
2171+ char * notice = PQresultErrorMessage (res );
2172+ char * stripped_notice ;
2173+ int len = strlen (notice );
2174+
2175+ /* Skip notices from other nodes */
2176+ if ( (* (int * )i )!= MtmNodeId - 1 )
2177+ return ;
2178+
2179+ stripped_notice = palloc0 (len );
2180+
2181+ /* Strip "NOTICE: " from beginning and "\n" from end of error string */
2182+ strncpy (stripped_notice ,notice + 9 ,len - 1 - 9 );
2183+
2184+ elog (NOTICE ,stripped_notice );
2185+ pfree (stripped_notice );
2186+ }
2187+
21692188static void MtmBroadcastUtilityStmt (char const * sql ,bool ignoreError )
21702189{
21712190int i = 0 ;
@@ -2194,6 +2213,7 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
21942213elog (ERROR ,"Failed to establish connection '%s' to node %d" ,Mtm -> nodes [i ].con .connStr ,failedNode );
21952214}
21962215}
2216+ PQsetNoticeReceiver (conns [i ],MtmNoticeReceiver ,& i );
21972217}
21982218}
21992219Assert (i == MtmNodes );