PQputCopyData's return value 0 should be considered fail (#7152)

release-10.2-hanefi
zhjwpku 2023-08-29 17:19:18 +08:00 committed by Marco Slot
parent 4bc11c9bb4
commit aed0ccec2f
1 changed files with 2 additions and 2 deletions

View File

@ -606,14 +606,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.
*