diff options
author | Robert Haas <rhaas@postgresql.org> | 2013-04-26 08:57:47 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2013-04-26 08:59:40 -0400 |
commit | 5eb7c4d364c8733d20d7fc8a453a145ee6da10cf (patch) | |
tree | 84cd9607c30db8e61f2e082b71560e3302d2a157 /src/interfaces/libpq/fe-protocol3.c | |
parent | c3d09b3bd23f5f65b5eb8124a3c7592dad85a50c (diff) | |
download | postgresql-5eb7c4d364c8733d20d7fc8a453a145ee6da10cf.tar.gz postgresql-5eb7c4d364c8733d20d7fc8a453a145ee6da10cf.zip |
libpq: Fix a few bits that didn't get the memo about COPY BOTH.
There's probably no real bug here at present, so not backpatching.
But it seems good to make these bits consistent with the rest of
libpq, so as to avoid future surprises.
Patch by me. Review by Tom Lane.
Diffstat (limited to 'src/interfaces/libpq/fe-protocol3.c')
-rw-r--r-- | src/interfaces/libpq/fe-protocol3.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c index 1e26e199198..7fa090adf35 100644 --- a/src/interfaces/libpq/fe-protocol3.c +++ b/src/interfaces/libpq/fe-protocol3.c @@ -1566,7 +1566,8 @@ pqGetline3(PGconn *conn, char *s, int maxlen) int status; if (conn->sock < 0 || - conn->asyncStatus != PGASYNC_COPY_OUT || + (conn->asyncStatus != PGASYNC_COPY_OUT && + conn->asyncStatus != PGASYNC_COPY_BOTH) || conn->copy_is_binary) { printfPQExpBuffer(&conn->errorMessage, @@ -1617,7 +1618,8 @@ pqGetlineAsync3(PGconn *conn, char *buffer, int bufsize) int msgLength; int avail; - if (conn->asyncStatus != PGASYNC_COPY_OUT) + if (conn->asyncStatus != PGASYNC_COPY_OUT + && conn->asyncStatus != PGASYNC_COPY_BOTH) return -1; /* we are not doing a copy... */ /* @@ -1671,7 +1673,8 @@ pqEndcopy3(PGconn *conn) PGresult *result; if (conn->asyncStatus != PGASYNC_COPY_IN && - conn->asyncStatus != PGASYNC_COPY_OUT) + conn->asyncStatus != PGASYNC_COPY_OUT && + conn->asyncStatus != PGASYNC_COPY_BOTH) { printfPQExpBuffer(&conn->errorMessage, libpq_gettext("no COPY in progress\n")); @@ -1679,7 +1682,8 @@ pqEndcopy3(PGconn *conn) } /* Send the CopyDone message if needed */ - if (conn->asyncStatus == PGASYNC_COPY_IN) + if (conn->asyncStatus == PGASYNC_COPY_IN || + conn->asyncStatus == PGASYNC_COPY_BOTH) { if (pqPutMsgStart('c', false, conn) < 0 || pqPutMsgEnd(conn) < 0) |