Sometimes, base64Encode returns data that belongs to the next string
in the buffer. This test, when failing, shows something like that:
-SELECT * FROM tabl_1 SETTINGS log_comment = ?;
-SELECT * FROM tabl_2 SETTINGS log_comment = ?;
+SELECT * FROM tabl_1 SETTINGS log_comment = ?;\0S
+SELECT * FROM tabl_2 SETTINGS log_comment = ?;\0c
Where the S at the end of the first string is the first S of the next
string in the buffer.
I don't know exactly why, but reading from query_log is how I manage
to reliably trigger the bug. The same code on literals, or even on
a different table, did not trigger the bug, something related to
alignment maybe.