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

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: BUG #16059: Tab-completion of filenames in COPY commands removesrequired quotes
Дата
Msg-id CA+bJJbwSiwa6eRSZ9s5Avjbza17Fnn1SZMi40+1vyaR+Z_R99Q@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #16059: Tab-completion of filenames in COPY commands removes required quotes  (PG Bug reporting form <noreply@postgresql.org>)
Ответы RE: BUG #16059: Tab-completion of filenames in COPY commandsremoves required quotes  (Steven Winfield <Steven.Winfield@cantabcapital.com>)
Список pgsql-bugs
Steven:

On Tue, Oct 15, 2019 at 3:12 PM PG Bug reporting form
<noreply@postgresql.org> wrote:
> 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).

Not saying it's not a bug, but bear in mind psql CAN NOT correctly
complete filenames for SERVER SIDE copy. You may be running in the
same machine, but even with this and using unix domain sockets it's
difficult to know what is at the other end of the socket ( not sure if
you can always know it even if you are root, and you can have things
like psql connecting through unix domain socket to pgbouncer which
forwards to I-do-not-know-where (.com) .

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

They are different beasts, in \copy you are not completing an sql
command to send to the server, you are completing a command to psql (
which it implemts using an sql command plus some magic ).

Francisco Olarte.



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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes
Следующее
От: Steven Winfield
Дата:
Сообщение: RE: BUG #16059: Tab-completion of filenames in COPY commandsremoves required quotes