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

From: Steven Winfield <Steven(dot)Winfield(at)cantabcapital(dot)com>
To: Francisco Olarte <folarte(at)peoplecall(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: RE: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes
Date: 2019-10-15 13:52:52
Message-ID: E9FA92C2921F31408041863B74EE4C2001BD9FF8A1@CCPMAILDAG03.cantab.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-10-15 18:52:12 BUG #16060: JDBC - badly gets DateOffsetTime value from database
Previous Message Francisco Olarte 2019-10-15 13:38:15 Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Finzel 2019-10-15 16:05:13 Re: BRIN index which is much faster never chosen by planner
Previous Message Heikki Linnakangas 2019-10-15 13:43:25 Re: Questions/Observations related to Gist vacuum