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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, steven(dot)winfield(at)cantabcapital(dot)com
Subject: Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes
Date: 2019-12-27 22:36:56
Message-ID: 14585.1577486216@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> One minor thing I noticed is that if I enter
> \copy t from '/tmp/t'<tab>
> and I have files /tmp/t and /tmp/tst then it removes the ending quote.

Yeah, that bothered me too. [ pokes at it for a bit... ] The
quote_file_name function isn't passed enough info to handle this
in a clean way, but we can make it work if we don't mind introducing
some more coupling with psql_completion, ie having the latter remember
whether the raw input word ended with a quote. As per v4.

> (The unpatched version removes *both* quotes. The quotes there are not
> mandatory, but the new version works better when there are files with
> whitespace in the name.)

Or when you're completing in a COPY rather than \copy --- then, removing
the quotes is broken whether there's whitespace or not.

regards, tom lane

Attachment Content-Type Size
psql-filename-completion-fixes-4.patch text/x-diff 19.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2019-12-27 23:35:30 Re: Memory-Bounded Hash Aggregation
Previous Message Alvaro Herrera 2019-12-27 20:23:32 Re: weird libpq GSSAPI comment

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2019-12-28 19:10:40 Re: Indexing on JSONB field not working
Previous Message Alvaro Herrera 2019-12-27 22:18:26 Re: A row-level trigger on a partitioned table is not created on a sub-partition created later