From d97f786296977233992d48e216b2c99298000aae Mon Sep 17 00:00:00 2001 From: zhjwpku Date: Tue, 29 Aug 2023 17:19:18 +0800 Subject: [PATCH] PQputCopyData's return value 0 should be considered fail (#7152) --- src/backend/distributed/connection/remote_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/connection/remote_commands.c b/src/backend/distributed/connection/remote_commands.c index 1dfd51781..15dd985ec 100644 --- a/src/backend/distributed/connection/remote_commands.c +++ b/src/backend/distributed/connection/remote_commands.c @@ -716,14 +716,14 @@ PutRemoteCopyData(MultiConnection *connection, const char *buffer, int nbytes) Assert(PQisnonblocking(pgConn)); int copyState = PQputCopyData(pgConn, buffer, nbytes); - if (copyState == -1) + if (copyState <= 0) { return false; } /* * PQputCopyData may have queued up part of the data even if it managed - * to send some of it succesfully. We provide back pressure by waiting + * to send some of it successfully. We provide back pressure by waiting * until the socket is writable to prevent the internal libpq buffers * from growing excessively. *