From d38c2cc5e7dbbeadc8023dd7c51dc4a1901c2c2a Mon Sep 17 00:00:00 2001 From: Juliana Fajardini Date: Fri, 28 Aug 2026 16:17:26 -0300 Subject: [PATCH] pgsql/logger: close json array if params truncated Pgsql logger would only open a ParameterStatus message array and only close it when a different type of message was seen (following an expected pgsql transaction style). However, if no different type of message followed the ParameterStatus message, the array remained open, leading to an unbalanced `}` count, and poisoning the whole JSON log, from that point on. Now, if we finish the responses logging loop without reaching another type of response, close the array, regardless. Ticket: #9012 (cherry picked from commit 85168b803693aa203382f6270015a6125a55fc8b) --- rust/src/pgsql/logger.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust/src/pgsql/logger.rs b/rust/src/pgsql/logger.rs index 8dee604f19..46125d4bba 100644 --- a/rust/src/pgsql/logger.rs +++ b/rust/src/pgsql/logger.rs @@ -172,6 +172,10 @@ fn log_response_object(tx: &PgsqlTransaction) -> Result log_response(response, &mut jb)?; } } + if array_open { + // the last stored response was a ParameterStatus so we still have an array open + jb.close()?; + } jb.close()?; Ok(jb) } @@ -341,7 +345,6 @@ fn log_startup_parameters(params: &PgsqlStartupParameters) -> Result