From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Removing support for COPY FROM STDIN in protocol version 2
Date: Thu, 4 Mar 2021 10:59:41 +0200
Message-ID: <8a174f9b-59e4-e231-5b66-1f01b314882a@iki.fi> (raw)
In-Reply-To: <1318732.1614814378@sss.pgh.pa.us>
References: <20210203160958.GA2341@alvherre.pgsql>
<3921698.1612369777@sss.pgh.pa.us>
<YBuaJXBJOPRVCA5I@paquier.xyz>
<6d6dcead-71fa-d9f6-4aaa-41104af0f27c@iki.fi>
<1318732.1614814378@sss.pgh.pa.us>
On 04/03/2021 01:32, Tom Lane wrote:
> Patched psql, trying to connect to a 7.3 server, reports this:
>
> $ psql -h ...
> psql: error: connection to server at "sss2" (192.168.1.3), port 5432 failed: FATAL: unsupported frontend protocol
>
> $
>
> Conversely, 7.3 psql trying to connect to a patched server reports:
>
> $ psql -h ...
> psql: FATAL: unsupported frontend protocol 2.0: server supports 3.0 to 3.0
>
> $
>
> 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. Before that,
postmaster had its own function, PacketSendError(), to send error
messages, and it did not append a newline. Commit 9b4bfbdc2 changed
postmaster to use elog(...) like everyone else, and elog(...) has always
appended a newline. So I think this extra newline that libpq adds is
needed if you try to connect to PostgreSQL 7.1 or earlier. I couldn't
commpile a 7.1 server to verify this, though.
I changed that code in libpq to check if the message already has a
newline, and only append one if it doesn't. This fixes the extra newline
when connecting with new libpq to a 7.3 server (and in the fork failure
message).
> I concur that 0001 attached is committable. I have not looked at
> your 0002, though.
Removed the entry from nls.mk, and pushed 0001. Thanks!
- Heikki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: hlinnaka@iki.fi, tgl@sss.pgh.pa.us, michael@paquier.xyz, alvherre@alvh.no-ip.org
Subject: Re: Removing support for COPY FROM STDIN in protocol version 2
In-Reply-To: <8a174f9b-59e4-e231-5b66-1f01b314882a@iki.fi>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox