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 1nF0jB-00072a-7n for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Feb 2022 21:30:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nF0jA-0001Pl-4Z for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Feb 2022 21:30:16 +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 1nF0j9-0001OZ-Rj for pgsql-hackers@lists.postgresql.org; Tue, 01 Feb 2022 21:30:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nF0j7-0003TN-9B for pgsql-hackers@lists.postgresql.org; Tue, 01 Feb 2022 21:30:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 211LUBUq960765; Tue, 1 Feb 2022 16:30:11 -0500 From: Tom Lane To: pgsql-hackers@lists.postgresql.org cc: pgbf@twiska.com Subject: psql tab completion versus Debian's libedit MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <960763.1643751011.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Feb 2022 16:30:11 -0500 Message-ID: <960764.1643751011@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I chased down the failure that kittiwake has been showing since 02b8048ba [1]. It's not hard to reproduce if you have an older Debian release and you build --with-libedit-preferred. Manual experimentation shows that when these versions of libedit complete a string containing double quotes, they insist on backslashing all the double quotes :-(. That is, if you have a table "foobar" and you type select * from "foo what you'll get is select * from \"foobar\" Digging into the source code, I find that libedit versions prior to 3.1-20210522 are unshakably convinced that anything you are completing should be escaped per shell quoting rules :-(. AFAICT there is no way to turn that off without replacing the *entire* tab completion infrastructure. 3.1-20210522 changed this to the extent of disabling quoting if the application supplies a rl_attempted_completion_function, as we do. (Fine for us, sucks for anybody who did want shell quoting.) I'm not too sure about the relationship of Debian's version of libedit to anyone else's. Apple's version, for one, lacks this bug. But it does appear that you don't want to use libedit on Debian unless you have a very late-model release. We can paper over the regression failure by making the test cases allow backslashes, but I wonder if we need something in the documentation discouraging people from choosing these versions of libedit over readline. They're pretty broken for completions involving double-quoted names even before 02b8048ba. regards, tom lane [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dkittiwake&dt= =3D2022-01-31%2016%3A24%3A48