RE: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes
Steven Winfield <steven.winfield@cantabcapital.com>
From: Steven Winfield <Steven.Winfield@cantabcapital.com>
To: Francisco Olarte <folarte@peoplecall.com>
Cc: "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2019-10-15T13:52:52Z
Lists: pgsql-bugs, pgsql-hackers
> 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) . That's very true, but at some point the decision was made to tab-complete COPY commands using information from the local filesystem, since that might be useful. I doubt there was ever an intention to take an otherwise-well-formed (partial) COPY command and make it invalid by removing a single quote in the middle of it! > 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 ). Yep, I'm aware of that - I'm just pointing out the difference in syntax between the two commands, which I had always believed to be near-drop-in replacements for each other syntax-wise. It's also relevant because the same tab-completion code is used for both \copy and COPY and currently can't distinguish between them. Perhaps complete_from_files() needs an extra argument to specify the quoting behaviour. Steven
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