Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: steven.winfield@cantabcapital.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2019-11-02T21:14:20Z
Lists: pgsql-bugs, pgsql-hackers
Attachments
- fix-bug-16059.patch (text/x-diff) patch
PG Bug reporting form <noreply@postgresql.org> writes: > 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. Yeah, it seems like a bad idea to override the user's choice to write a quote, even if one is not formally necessary. I propose the attached. regards, tom lane
Commits
-
Improve psql's tab completion for filenames.
- cd69ec66c886 13.0 landed
-
Modernize our readline API a tad.
- 5e7bedc5adba 13.0 landed
-
Add tab completion for EXPLAIN (SETTINGS) in psql
- 4b011cad272e 13.0 cited