Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHjpm-0007Kf-TQ for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Mar 2021 08:59:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lHjpl-0005U3-Rj for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Mar 2021 08:59:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHjpl-0005Tv-Gq for pgsql-hackers@lists.postgresql.org; Thu, 04 Mar 2021 08:59:49 +0000 Received: from meesny.iki.fi ([2001:67c:2b0:1c1::201]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHjpj-00020o-56 for pgsql-hackers@postgresql.org; Thu, 04 Mar 2021 08:59:48 +0000 Received: from [192.168.1.113] (dsl-hkibng22-54faa4-119.dhcp.inet.fi [84.250.164.119]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id E6EF52006E; Thu, 4 Mar 2021 10:59:41 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1614848382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TtN+GWM0p9V916T6EQtrPDxDO2XwYCQvarIGmPVl8gA=; b=ePhCZhpvWf+8y3x97WSRKijcq4Lrn1dsQe6fCsvri+RdEE22Dga4mxE+EZ/oMVCmXdloCp Ix7tkTpcLcjSadUFbmmr6uHJFEjW0b5t025uXB0k5b5w8YfDFDxvhPEh0G47+6BdnEonSD jq4+Lf7o/YqUDC10h3yxcdBd8HUzZok= Subject: Re: Removing support for COPY FROM STDIN in protocol version 2 To: Tom Lane Cc: Michael Paquier , Alvaro Herrera , pgsql-hackers References: <20210203160958.GA2341@alvherre.pgsql> <3921698.1612369777@sss.pgh.pa.us> <6d6dcead-71fa-d9f6-4aaa-41104af0f27c@iki.fi> <1318732.1614814378@sss.pgh.pa.us> From: Heikki Linnakangas Message-ID: <8a174f9b-59e4-e231-5b66-1f01b314882a@iki.fi> Date: Thu, 4 Mar 2021 10:59:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <1318732.1614814378@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=meesny; d=iki.fi; t=1614848382; a=rsa-sha256; cv=none; b=yBdd4n+HmVqziH0GCV49uQb43qlhDYcpkHuxvVTa7YIZRs1zaolRyYmeLmRwf6VmgbV13n bGpYlVkq+PAraZoihdWt8EUbC5/FdwAzTiQwzT2jIPx79I7HrCAvNkONtSWk11Ho9L9NDw 1oPpNzzK11TPZX7bsW5fUiBvLbUoiqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1614848382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TtN+GWM0p9V916T6EQtrPDxDO2XwYCQvarIGmPVl8gA=; b=hkuojjwB16lx78aKRrBn5LkB9A67NLGh6eehMgJrJXYuw0Zg3b5bGSp45o8e77uOqr18jU Jy115nWPDtHyWMxBsra+1xL0GCJD8UPDG+mloE7ZPNHVijc5NPF9lvhR0WawQ5ex6wDExt QfjUt/TCeB5dEP/PYAvrgEugroq81QM= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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