@@ -2710,11 +2710,12 @@ static bool MtmRunUtilityStmt(PGconn* conn, char const* sql, char **errmsg)
2710
2710
if (!ret ) {
2711
2711
char * errstr = PQresultErrorMessage (result );
2712
2712
int errlen = strlen (errstr );
2713
+ if (errlen > 9 ) {
2714
+ * errmsg = palloc0 (errlen );
2713
2715
2714
- * errmsg = palloc0 (errlen );
2715
-
2716
- /* Strip "ERROR: " from beginning and "\n" from end of error string */
2717
- strncpy (* errmsg ,errstr + 8 ,errlen - 1 - 8 );
2716
+ /* Strip "ERROR: " from beginning and "\n" from end of error string */
2717
+ strncpy (* errmsg ,errstr + 8 ,errlen - 1 - 8 );
2718
+ }
2718
2719
}
2719
2720
2720
2721
PQclear (result );
@@ -2781,7 +2782,7 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
2781
2782
do {
2782
2783
PQfinish (conns [i ]);
2783
2784
}while (-- i >=0 );
2784
- elog (ERROR ,"Failed to establish connection '%s' to node %d" ,Mtm -> nodes [failedNode ].con .connStr ,failedNode );
2785
+ elog (ERROR ,"Failed to establish connection '%s' to node %d" ,Mtm -> nodes [failedNode ].con .connStr ,failedNode + 1 );
2785
2786
}
2786
2787
}
2787
2788
PQsetNoticeReceiver (conns [i ],MtmNoticeReceiver ,& i );