Re: Removing support for COPY FROM STDIN in protocol version 2

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Michael Paquier <michael@paquier.xyz>, Alvaro Herrera <alvherre@alvh.no-ip.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-03-04T16:11:39Z
Lists: pgsql-hackers
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> On 04/03/2021 01:32, Tom Lane wrote:
>> I'm not sure where the extra newlines are coming from, and it seems
>> unlikely to be worth worrying over.  This behavior is good enough for me.

> fe-connect.c appends a newline for any errors in pre-3.0 format:

>> 		/*
>> 		 * The postmaster typically won't end its message with a
>> 		 * newline, so add one to conform to libpq conventions.
>> 		 */
>> 		appendPQExpBufferChar(&conn->errorMessage, '\n');

> That comment is wrong. The postmaster *does* end all its error messages 
> with a newline. This changed in commit 9b4bfbdc2c in 7.2.

Ah-hah, and the bit you show here came in with 2af360ed1, in 7.0.
I'm surprised though that we didn't notice that the newline was now
usually redundant.  This was a commonly taken code path until 7.4.

Anyway, your fix seems fine ... I wonder if we should back-patch it?

			regards, tom lane



Commits

  1. Avoid extra newline in errors received in FE protocol version 2.

  2. Remove server and libpq support for old FE/BE protocol version 2.

  3. Handle reading of startup packet and authentication exchange after forking