Fix query string truncation while writing it to server logs
Long queries are truncated when logged. This wasn't done correctly
because it doesn't consider the encoding. This results in some utf
characters being truncated in the middle.
@@ -3492,7 +3492,7 @@ append_string_to_pipe_chunk(PipeProtoChunk *buffer, const char* input)
*/
if (len >= PIPE_MAX_PAYLOAD * 20)
{
- len = PIPE_MAX_PAYLOAD * 20 - 1;
+ len = pg_mbcliplen(input, len, PIPE_MAX_PAYLOAD * 20 - 1);
}
char *data = buffer->data + buffer->hdr.len;
