mirror of
https://github.com/percona/pg_stat_monitor.git
synced 2026-02-04 05:56:21 +00:00
PG-2116 Truncate query strings at multi-byte character boundaries
Make sure we never create broken encodings in query strings by making the truncation of query strings multi-byte aware. An alternative would be to change the rule for truncation to be based on number of characters, as the documentation claims it is, but I do not think that would be significantly better. Either works just fine so we just pick one. Based on bug report from Ivan Vyazmitinov: https://github.com/percona/pg_stat_monitor/issues/599
This commit is contained in:
committed by
Andreas Karlsson
parent
fef78a8f6f
commit
5526e413c1
@@ -1983,7 +1983,7 @@ pgsm_store(pgsmEntry *entry)
|
||||
|
||||
/* New query, truncate length if necessary. */
|
||||
if (query_len > pgsm_query_max_len)
|
||||
query_len = pgsm_query_max_len;
|
||||
query_len = pg_mbcliplen(query, query_len, pgsm_query_max_len);
|
||||
|
||||
/* Save the query text in raw dsa area */
|
||||
query_dsa_area = get_dsa_area_for_query_text();
|
||||
|
||||
Reference in New Issue
Block a user