> 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
localfilesystem, 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
removinga 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
believedto 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
betweenthem.
Perhaps complete_from_files() needs an extra argument to specify the quoting behaviour.
Steven