From 3174d69fb96a66173224e60ec7053b988d5ed4d9 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 4 Mar 2021 10:45:55 +0200 Subject: 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 --- src/backend/commands/async.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/backend/commands/async.c') diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 42b232d98b1..4b16fb56825 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -2311,8 +2311,7 @@ NotifyMyFrontEnd(const char *channel, const char *payload, int32 srcPid) pq_beginmessage(&buf, 'A'); pq_sendint32(&buf, srcPid); pq_sendstring(&buf, channel); - if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3) - pq_sendstring(&buf, payload); + pq_sendstring(&buf, payload); pq_endmessage(&buf); /* -- cgit v1.2.3