Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes
Дата
Msg-id 12699.1578058657@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #16059: Tab-completion of filenames in COPY commands removesrequired quotes  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: sidewinder has one failure
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Add basic TAP tests for psql's tab-completion logic.