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: Fri, 03 Jan 2020 08:37:37 -0500
Message-ID: <12699.1578058657@sss.pgh.pa.us> (raw)
In-Reply-To: <6ccd23e4-ce58-c2b5-39a1-801a9937ae86@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>
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 2019-11-03 23:40, Tom Lane wrote:
>> * The patch now always quotes completed filenames, so quote_if_needed()
>> is misnamed and overcomplicated for this use-case. I left the extra
>> generality in place for possible future use. On the other hand, this
>> is the*only* use-case, so you could also argue that we should just
>> simplify the function's API. I have no strong opinion about that.
> I haven't found an explanation in this thread why it does always quote
> now. That seems a bit unusual. Is there a reason for this? Can we do
> without it?
The core problem we're trying to solve is stated in the thread title:
if you do
prompt# copy mytab from 'myfil<TAB>
then (assuming some completion is available) the current code actually
*removes* the quote, which is completely wrong. Even if the user
didn't type a leading quote, it's better to add one, because COPY
won't work otherwise.
It'd be possible, perhaps, to distinguish between this case and the
cases in backslash commands, which are okay with omitted quotes
(for some filenames). I'm not sure that that would be an improvement
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: <12699.1578058657@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