*** src/backend/postmaster/pgstat.c 2011-09-22 17:57:57.000000000 -0400 --- ../postgresql-9.1.1wip/src/backend/postmaster/pgstat.c 2011-10-31 17:17:47.000000000 -0400 *************** *** 2486,2493 **** */ start_timestamp = GetCurrentStatementStartTimestamp(); ! len = strlen(cmd_str); ! len = pg_mbcliplen(cmd_str, len, pgstat_track_activity_query_size - 1); /* * Update my status entry, following the protocol of bumping --- 2486,2493 ---- */ start_timestamp = GetCurrentStatementStartTimestamp(); ! len = strlen(cmd_str); ! len = pg_mbcliplen(cmd_str, len, pgstat_track_activity_query_size - 1); /* * Update my status entry, following the protocol of bumping *************** *** 2495,2504 **** * ensure the compiler doesn't try to get cute. */ beentry->st_changecount++; ! beentry->st_activity_start_timestamp = start_timestamp; ! memcpy((char *) beentry->st_activity, cmd_str, len); ! beentry->st_activity[len] = '\0'; beentry->st_changecount++; Assert((beentry->st_changecount & 1) == 0); --- 2495,2524 ---- * ensure the compiler doesn't try to get cute. */ beentry->st_changecount++; + beentry->st_activity_start_timestamp = start_timestamp; ! if ( memcmp(cmd_str," i",8) == 0) ! { ! char *tString; ! tString = pnstrdup(" in transaction\n: Previous: ",34); ! len = strlen(tString); ! len = snprintf (tString, ! len + ! pg_mbcliplen(beentry->st_activity, ! strlen(beentry->st_activity), ! pgstat_track_activity_query_size -1 ), ! "%s%s",tString,beentry->st_activity); ! memcpy((char *) beentry->st_activity, tString, len); ! beentry->st_activity[len] = '\0'; ! pfree((char*) tString); ! ! } ! else ! { ! ! memcpy((char *) beentry->st_activity, cmd_str, len); ! beentry->st_activity[len] = '\0'; ! } beentry->st_changecount++; Assert((beentry->st_changecount & 1) == 0);