Skip to content

Commit

Permalink
PQputCopyData's return value 0 should be considered fail (#7152)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhjwpku authored and marcoslot committed Aug 29, 2023
1 parent 7d24ed0 commit 0ae0501
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backend/distributed/connection/remote_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 0ae0501

Please sign in to comment.