At Tue, 14 Jul 2020 13:31:31 +0900 (JST), Kyotaro Horiguchi <horikyota....@gmail.com> wrote in > Agreed to separate the change from this issue. I also don't think > that change in behavior dramatically improve the situation since we > should have had a bunch of trouble when a write actually failed in the > normal case. > > I'm going to post a patch to change the comment of pqPacketSend.
So this is a proposal to add a description about the behavior on write failure. The last half of the addition is a copy from the comment of pqFlush. regards. -- Kyotaro Horiguchi NTT Open Source Software Center
>From 5e01ed1fccce083b1e1c13692d19474378c66db6 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horikyoga....@gmail.com> Date: Wed, 15 Jul 2020 11:27:57 +0900 Subject: [PATCH] Explain pqPacketSend more precisely. The comment explains that the function always returns STATUS_ERRUR for write failure, but this may not be the case. Add description to make it clear that there is such a case. --- src/interfaces/libpq/fe-connect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 7bee9dd201..af2818add4 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -4505,7 +4505,9 @@ PQrequestCancel(PGconn *conn) * buf, buf_len: contents of message. The given length includes only what * is in buf; the message type and message length fields are added here. * - * RETURNS: STATUS_ERROR if the write fails, STATUS_OK otherwise. + * RETURNS: STATUS_ERROR if the write fails, STATUS_OK otherwise. Note that the + * function may return STATUS_OK even if it failed to write to the underlying + * socket. (See pqSendSome comments about how failure should be handled.) * SIDE_EFFECTS: may block. * * Note: all messages sent with this routine have a length word, whether -- 2.18.4