Don't use pq_putmessage in socket comm function

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Don't use pq_putmessage in socket comm function
Date: 2026-07-22 08:16:53
Message-ID: CAO6_Xqpf5+Rzw_-XOOz-d-R5x6_2JHtpnzXP0nrYWiHyZokA_Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Currently, socket_putmessage_noblock enlarges the output buffer and
then calls pq_putmessage to store the message in the buffer.

pq_putmessage is a macro redirecting to PqCommMethods->putmessage.
This is normally set to socket_putmessage, so
socket_putmessage_noblock calls socket_putmessage as desired.

However, if a custom PqCommMethods is defined, any call to
socket_putmessage_noblock will then loop to the custom putmessage.

This patch fixes the issue by directly using socket_putmessage in
socket_putmessage_noblock.

Regards,
Anthonin Bonnefoy

Attachment Content-Type Size
v1-0001-Don-t-use-pq_putmessage-in-socket-comm-function.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2026-07-22 08:28:01 Re: Allow progress tracking of sub-commands
Previous Message Jonathan Gonzalez V. 2026-07-22 08:00:08 Re: [PATCH] Cover get_json_table_plan() with tests