From 5d4c8d7ffba154750d7038982c90429102e5837b Mon Sep 17 00:00:00 2001 From: Alain Frisch Date: Wed, 24 Sep 2025 15:56:38 +0100 Subject: [PATCH] Need to use PQsendQueryParams, not PQsendQuery, to enable binary_result --- lib/postgresql_stubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/postgresql_stubs.c b/lib/postgresql_stubs.c index 56ed610..c11a1f7 100644 --- a/lib/postgresql_stubs.c +++ b/lib/postgresql_stubs.c @@ -961,7 +961,7 @@ CAMLprim intnat PQsendQueryParams_stub(value v_conn, value v_query, intnat res; copy_binary_params(v_params, v_binary_params, nparams, &formats, &lengths); bool binary_result = Bool_val(v_binary_result); - res = (nparams == 0) + res = (nparams == 0 && !binary_result) ? PQsendQuery(conn, query) : PQsendQueryParams(conn, query, nparams, param_types, params, lengths, formats, binary_result);