aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-protocol3.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2010-12-11 09:27:37 -0500
committerRobert Haas <rhaas@postgresql.org>2010-12-11 09:27:37 -0500
commitd3d414696f39e2b57072fab3dd4fa11e465be4ed (patch)
treef99e5cd6209d2462424d22bcee41e036741b45f5 /src/interfaces/libpq/fe-protocol3.c
parent20f396429186a35a81fc7ef3ad34c3134ead2992 (diff)
downloadpostgresql-d3d414696f39e2b57072fab3dd4fa11e465be4ed.tar.gz
postgresql-d3d414696f39e2b57072fab3dd4fa11e465be4ed.zip
Allow bidirectional copy messages in streaming replication mode.
Fujii Masao. Review by Alvaro Herrera, Tom Lane, and myself.
Diffstat (limited to 'src/interfaces/libpq/fe-protocol3.c')
-rw-r--r--src/interfaces/libpq/fe-protocol3.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index cf9407de7ae..c398304156c 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -358,6 +358,12 @@ pqParseInput3(PGconn *conn)
conn->asyncStatus = PGASYNC_COPY_OUT;
conn->copy_already_done = 0;
break;
+ case 'W': /* Start Copy Both */
+ if (getCopyStart(conn, PGRES_COPY_BOTH))
+ return;
+ conn->asyncStatus = PGASYNC_COPY_BOTH;
+ conn->copy_already_done = 0;
+ break;
case 'd': /* Copy Data */
/*
@@ -1196,7 +1202,8 @@ getNotify(PGconn *conn)
}
/*
- * getCopyStart - process CopyInResponse or CopyOutResponse message
+ * getCopyStart - process CopyInResponse, CopyOutResponse or
+ * CopyBothResponse message
*
* parseInput already read the message type and length.
*/
@@ -1367,6 +1374,7 @@ getCopyDataMessage(PGconn *conn)
/*
* PQgetCopyData - read a row of data from the backend during COPY OUT
+ * or COPY BOTH
*
* If successful, sets *buffer to point to a malloc'd row of data, and
* returns row length (always > 0) as result.
@@ -1390,10 +1398,10 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async)
if (msgLength < 0)
{
/*
- * On end-of-copy, exit COPY_OUT mode and let caller read status
- * with PQgetResult(). The normal case is that it's Copy Done,
- * but we let parseInput read that. If error, we expect the state
- * was already changed.
+ * On end-of-copy, exit COPY_OUT or COPY_BOTH mode and let caller
+ * read status with PQgetResult(). The normal case is that it's
+ * Copy Done, but we let parseInput read that. If error, we expect
+ * the state was already changed.
*/
if (msgLength == -1)
conn->asyncStatus = PGASYNC_BUSY;