From 544d25b7af958ca6c03e98bfbc1538c295b30601 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Thu, 23 Jul 2026 16:48:40 +0900 Subject: [PATCH] Fix socket_putmessage_noblock() to call socket_putmessage() socket_putmessage_noblock() used pq_putmessage(), which redirects to PqCommMethods->putmessage. In the common cases, this points to socket_putmessage(), but it would become incorrect if PqCommMethods points to a different implementation. This change may look like a bug, but as far as I can see this is mostly cosmetic. The code is able to work currently, as the repalloc() done in the noblock() call ensures that the blocking path of internal_putbytes() is never reached. The issue has gone unnoticed since 2bd9e412f92b. Author: Anthonin Bonnefoy Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAO6_Xqpf5+Rzw_-XOOz-d-R5x6_2JHtpnzXP0nrYWiHyZokA_Q@mail.gmail.com --- src/backend/libpq/pqcomm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index ee9a39107e6..aaae7214f13 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -1537,7 +1537,7 @@ socket_putmessage_noblock(char msgtype, const char *s, size_t len) PqSendBuffer = repalloc(PqSendBuffer, required); PqSendBufferSize = required; } - res = pq_putmessage(msgtype, s, len); + res = socket_putmessage(msgtype, s, len); Assert(res == 0); /* should not fail when the message fits in * buffer */ } -- 2.47.3