Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1if55M-0006P4-K0 for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Dec 2019 16:43:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1if55K-0002h0-OM for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Dec 2019 16:43:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1if55K-0002gt-Fc for pgsql-hackers@lists.postgresql.org; Wed, 11 Dec 2019 16:43:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1if55D-0004Bt-Su for pgsql-hackers@lists.postgresql.org; Wed, 11 Dec 2019 16:43:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xBBGhNT9017797; Wed, 11 Dec 2019 11:43:23 -0500 From: Tom Lane To: Alvaro Herrera cc: pgsql-hackers@lists.postgresql.org, steven.winfield@cantabcapital.com Subject: Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes In-reply-to: <20191211015552.GA6301@alvherre.pgsql> References: <20191211015552.GA6301@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 10 Dec 2019 22:55:52 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17795.1576082603.1@sss.pgh.pa.us> Date: Wed, 11 Dec 2019 11:43:23 -0500 Message-ID: <17796.1576082603@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > I tested this on libreadline 7.x (where #define > HAVE_RL_FILENAME_COMPLETION_FUNCTION 1). I noticed that if I enter a > filename that doesn't exist and then , it adds a closing quote. > Bash manages to do nothing somehow, which is the desired behavior IMO. Hmm. I'll take a look, but I'm not terribly hopeful. I have looked briefly at what Bash does for filename completion, and as I recall it was massive, spaghetti-ish, and way too much in bed with various implementation details of libreadline --- they don't pretend to work with libedit. I'm not prepared to go there. It's reasonable for Bash to expend huge effort on filename completion, because that's such a core use-case for them, but I don't think it deserves as much work in psql. > I don't quite understand why a readline library that doesn't have > rl_filename_completion_function is known to have a > filename_completion_function, ie. this bit > #ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION > #define filename_completion_function rl_filename_completion_function > #else > /* decl missing in some header files, but function exists anyway */ > extern char *filename_completion_function(); > #endif I think the point is that before rl_filename_completion_function the function existed but was just called filename_completion_function. It's possible that that's obsolete --- I've not really checked. regards, tom lane