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

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #16059: Tab-completion of filenames in COPY commands removes required quotes
Дата
Msg-id 16059-8836946734c02b84@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #16059: Tab-completion of filenames in COPY commands removesrequired quotes  (Francisco Olarte <folarte@peoplecall.com>)
Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16059
Logged by:          Steven Winfield
Email address:      steven.winfield@cantabcapital.com
PostgreSQL version: 11.5
Operating system:   Linux
Description:

As per the documentation[1], the COPY command requires the output filename
to be single-quoted.

However, when using psql, a partial COPY command such as this...
COPY pg_catalog.pg_class TO '/usr
...will, on hitting TAB, be converted to this...
COPY pg_catalog.pg_class TO /usr/
...requiring the user to move the cursor back to re-insert the single quote
before finishing the command and executing.

The issue seems to be somewhere around here[2], where complete_from_files[3]
is used to suggest replacements - that function strips quotes from the
existing (partial) filename but doesn't put them back unless quote_if_needed
is true (which I guess it isn't, unless there is a space in the filename for
example).

Note that using the \copy command instead works fine, as filenames do not
need to be quoted in that case.

[1] https://www.postgresql.org/docs/11/sql-copy.html
[2]
https://github.com/postgres/postgres/blob/4b011cad272e997935eb8d80ab741a40b395fdf5/src/bin/psql/tab-complete.c#L2234
[3]
https://github.com/postgres/postgres/blob/4b011cad272e997935eb8d80ab741a40b395fdf5/src/bin/psql/tab-complete.c#L4350


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

Предыдущее
От: death lock
Дата:
Сообщение: Re: BUG #16049: log_line_prefix=%a and log_connections -application_name missing
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: BUG #16059: Tab-completion of filenames in COPY commands removesrequired quotes