#include "catalog/pg_shadow.h"
#include "catalog/pg_database.h"
#include "libpq/pqsignal.h"
+#ifdef MULTIBYTE
+#include "mb/pg_wchar.h"
+#endif
#include "miscadmin.h"
#include "utils/memutils.h"
#include "storage/backendid.h"
return;
len = strlen(what);
+#ifdef MULTIBYTE
+ len = pg_mbcliplen((const unsigned char *)what, len, PGSTAT_ACTIVITY_SIZE - 1);
+#else
if (len >= PGSTAT_ACTIVITY_SIZE)
len = PGSTAT_ACTIVITY_SIZE - 1;
+#endif
memcpy(msg.m_what, what, len);
msg.m_what[len] = '\0';