diff --git a/src/backend/postgres/query.rs b/src/backend/postgres/query.rs index 2970f4442..1fd39acb6 100644 --- a/src/backend/postgres/query.rs +++ b/src/backend/postgres/query.rs @@ -156,12 +156,11 @@ impl QueryBuilder for PostgresQueryBuilder { } fn write_bytes(&self, bytes: &[u8], buffer: &mut String) { - write!( - buffer, - "'\\x{}'", - bytes.iter().map(|b| format!("{b:02X}")).collect::() - ) - .unwrap() + write!(buffer, "'\\x").unwrap(); + for b in bytes { + format!("{b:02X}"); + } + write!(buffer, "'").unwrap(); } fn if_null_function(&self) -> &str { diff --git a/src/backend/query_builder.rs b/src/backend/query_builder.rs index fd8c7677d..0b2e6100e 100644 --- a/src/backend/query_builder.rs +++ b/src/backend/query_builder.rs @@ -1405,12 +1405,11 @@ pub trait QueryBuilder: #[doc(hidden)] /// Write bytes enclosed with engine specific byte syntax fn write_bytes(&self, bytes: &[u8], buffer: &mut String) { - write!( - buffer, - "x'{}'", - bytes.iter().map(|b| format!("{b:02X}")).collect::() - ) - .unwrap() + write!(buffer, "x'").unwrap(); + for b in bytes { + format!("{b:02X}"); + } + write!(buffer, "'").unwrap(); } #[doc(hidden)]