summaryrefslogtreecommitdiff
path: root/src/backend/tcop
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-04-22 00:08:07 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-04-22 00:08:07 +0000
commit5ed27e35f35f6c354b1a7120ec3a3ce57f93e73e (patch)
tree9ed912fbf02c36160a88881764735f8eab6103b9 /src/backend/tcop
parentca944bd2d41814712cb4a4810ab4aa490f23a853 (diff)
downloadpostgresql-5ed27e35f35f6c354b1a7120ec3a3ce57f93e73e.tar.gz
Another round of protocol changes. Backend-to-frontend messages now all
have length words. COPY OUT reimplemented per new protocol: it doesn't need \. anymore, thank goodness. COPY BINARY to/from frontend works, at least as far as the backend is concerned --- libpq's PQgetline API is not up to snuff, and will have to be replaced with something that is null-safe. libpq uses message length words for performance improvement (no cycles wasted rescanning long messages), but not yet for error recovery.
Diffstat (limited to 'src/backend/tcop')
-rw-r--r--src/backend/tcop/dest.c16
-rw-r--r--src/backend/tcop/fastpath.c5
-rw-r--r--src/backend/tcop/postgres.c7
3 files changed, 16 insertions, 12 deletions
diff --git a/src/backend/tcop/dest.c b/src/backend/tcop/dest.c
index 07e4614e79..5ccaa60995 100644
--- a/src/backend/tcop/dest.c
+++ b/src/backend/tcop/dest.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.52 2003/04/19 00:02:29 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.53 2003/04/22 00:08:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -141,7 +141,9 @@ EndCommand(const char *commandTag, CommandDest dest)
* libpq's crufty way of determining whether a multiple-command
* query string is done. In protocol 2.0 it's probably not really
* necessary to distinguish empty queries anymore, but we still do it
- * for backwards compatibility with 1.0.
+ * for backwards compatibility with 1.0. In protocol 3.0 it has some
+ * use again, since it ensures that there will be a recognizable end
+ * to the response to an Execute message.
* ----------------
*/
void
@@ -153,9 +155,13 @@ NullCommand(CommandDest dest)
case Remote:
/*
- * tell the fe that we saw an empty query string
+ * tell the fe that we saw an empty query string. In protocols
+ * before 3.0 this has a useless empty-string message body.
*/
- pq_putbytes("I", 2); /* note we send I and \0 */
+ if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
+ pq_putemptymessage('I');
+ else
+ pq_puttextmessage('I', "");
break;
case Debug:
@@ -184,7 +190,7 @@ ReadyForQuery(CommandDest dest)
case RemoteInternal:
case Remote:
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
- pq_putbytes("Z", 1);
+ pq_putemptymessage('Z');
/* Flush output at end of cycle in any case. */
pq_flush();
break;
diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c
index eeddea6f6e..b875095734 100644
--- a/src/backend/tcop/fastpath.c
+++ b/src/backend/tcop/fastpath.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.58 2003/04/19 00:02:29 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.59 2003/04/22 00:08:07 tgl Exp $
*
* NOTES
* This cruft is the server side of PQfn.
@@ -119,8 +119,7 @@ SendFunctionResult(Datum retval, bool retbyval, int retlen)
{
StringInfoData buf;
- pq_beginmessage(&buf);
- pq_sendbyte(&buf, 'V');
+ pq_beginmessage(&buf, 'V');
if (retlen != 0)
{
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index fcc6591f7c..5c51a1056a 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.322 2003/04/19 00:02:29 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.323 2003/04/22 00:08:07 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -1821,8 +1821,7 @@ PostgresMain(int argc, char *argv[], const char *username)
{
StringInfoData buf;
- pq_beginmessage(&buf);
- pq_sendbyte(&buf, 'K');
+ pq_beginmessage(&buf, 'K');
pq_sendint(&buf, (int32) MyProcPid, sizeof(int32));
pq_sendint(&buf, (int32) MyCancelKey, sizeof(int32));
pq_endmessage(&buf);
@@ -1832,7 +1831,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.322 $ $Date: 2003/04/19 00:02:29 $\n");
+ puts("$Revision: 1.323 $ $Date: 2003/04/22 00:08:07 $\n");
}
/*