mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Remove server and libpq support for old FE/BE protocol version 2.
Protocol version 3 was introduced in PostgreSQL 7.4. There shouldn't be many clients or servers left out there without version 3 support. But as a courtesy, I kept just enough of the old protocol support that we can still send the "unsupported protocol version" error in v2 format, so that old clients can display the message properly. Likewise, libpq still understands v2 ErrorResponse messages when establishing a connection. The impetus to do this now is that I'm working on a patch to COPY FROM, to always prefetch some data. We cannot do that safely with the old protocol, because it requires parsing the input one byte at a time to detect the end-of-copy marker. Reviewed-by: Tom Lane, Alvaro Herrera, John Naylor Discussion: https://www.postgresql.org/message-id/9ec25819-0a8a-d51a-17dc-4150bb3cca3b%40iki.fi
This commit is contained in:
@@ -226,13 +226,8 @@ EndReplicationCommand(const char *commandTag)
|
||||
/* ----------------
|
||||
* NullCommand - tell dest that an empty query string was recognized
|
||||
*
|
||||
* In FE/BE protocol version 1.0, this hack is necessary to support
|
||||
* 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. 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.
|
||||
* This ensures that there will be a recognizable end to the response
|
||||
* to an Execute message in the extended query protocol.
|
||||
* ----------------
|
||||
*/
|
||||
void
|
||||
@@ -244,14 +239,8 @@ NullCommand(CommandDest dest)
|
||||
case DestRemoteExecute:
|
||||
case DestRemoteSimple:
|
||||
|
||||
/*
|
||||
* tell the fe that we saw an empty query string. In protocols
|
||||
* before 3.0 this has a useless empty-string message body.
|
||||
*/
|
||||
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
|
||||
pq_putemptymessage('I');
|
||||
else
|
||||
pq_putmessage('I', "", 1);
|
||||
/* Tell the FE that we saw an empty query string */
|
||||
pq_putemptymessage('I');
|
||||
break;
|
||||
|
||||
case DestNone:
|
||||
@@ -286,7 +275,6 @@ ReadyForQuery(CommandDest dest)
|
||||
case DestRemote:
|
||||
case DestRemoteExecute:
|
||||
case DestRemoteSimple:
|
||||
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
|
||||
{
|
||||
StringInfoData buf;
|
||||
|
||||
@@ -294,8 +282,6 @@ ReadyForQuery(CommandDest dest)
|
||||
pq_sendbyte(&buf, TransactionBlockStatusCode());
|
||||
pq_endmessage(&buf);
|
||||
}
|
||||
else
|
||||
pq_putemptymessage('Z');
|
||||
/* Flush output at end of cycle in any case. */
|
||||
pq_flush();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user