From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers@lists.postgresql.org
Cc: steven.winfield@cantabcapital.com
Subject: Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes
Date: Mon, 13 Jan 2020 15:36:34 -0500
Message-ID: <28497.1578947794@sss.pgh.pa.us> (raw)
In-Reply-To: <1ed54e8f-d84e-bfbe-ffad-890015e12735@2ndquadrant.com>
References: <16059-8836946734c02b84@postgresql.org>
<30313.1572729260@sss.pgh.pa.us>
<1628.1572820800@sss.pgh.pa.us>
<6ccd23e4-ce58-c2b5-39a1-801a9937ae86@2ndquadrant.com>
<12699.1578058657@sss.pgh.pa.us>
<32307.1578290788@sss.pgh.pa.us>
<1ed54e8f-d84e-bfbe-ffad-890015e12735@2ndquadrant.com>
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> The file name completion portion of this patch seems to work quite well now.
Thanks for testing!
> I have found a weird behavior with identifier quoting, which is not the
> subject of this patch, but it appears to be affected by it.
> The good thing is that the new code will behave sensibly with
> select * from "pg_cl<TAB>
> which the old code didn't offer anything on.
Check.
> The problem is that if you have
> create table "test""1" (a int);
> then the new code responds to
> select * from "te<TAB>
> by making that
> select * from "te"
> whereas the old code curiously handled that perfectly.
Right. The underlying cause of both these changes seems to be that
what readline passes to psql_completion is just the contents of the
string, now that we've told it that double-quote is a string quoting
character. So that works fine with 'pg_cl' which didn't need quoting
anyway. In your second example, because we generate possible matches
that are already quoted-if-necessary, we fail to find anything that
bare 'te' is a prefix of, where before we were considering '"te' and
it worked.
I'll think about how to improve this. Given that we're dequoting
filenames explicitly anyway, maybe we don't need to tell readline that
double-quote is a quoting character. Another idea is that maybe
we ought to refactor things so that identifier dequoting and requoting
is handled explicitly, similarly to the way filenames work now.
That would make the patch a lot bigger though.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com, 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: <28497.1578947794@sss.pgh.pa.us>
* 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