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-12 05:49:50
Message-ID: 4158.1576129790@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

I wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
>> I don't quite understand why a readline library that doesn't have
>> rl_filename_completion_function is known to have a
>> filename_completion_function, ie. this bit

>> #ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION
>> #define filename_completion_function rl_filename_completion_function
>> #else
>> /* decl missing in some header files, but function exists anyway */
>> extern char *filename_completion_function();
>> #endif

> I think the point is that before rl_filename_completion_function the
> function existed but was just called filename_completion_function.
> It's possible that that's obsolete --- I've not really checked.

I had a look through the buildfarm results, and it seems that the only
(non-Windows) animals that don't HAVE_RL_FILENAME_COMPLETION_FUNCTION
are prairiedog and locust. prairiedog is using the libedit that
Apple supplied in its stone-age version of macOS, and I imagine the
same can be said of locust, though that's one macOS release newer.

prairiedog's version does define filename_completion_function:

$ grep completion_func /usr/include/readline/readline.h
extern CPPFunction *rl_attempted_completion_function;
char *filename_completion_function(const char *, int);
char *username_completion_function(const char *, int);

so the assumption embodied in our code is both correct and necessary
so far as the current universe of buildfarm critters is concerned.

Having said that, prairiedog's version of libedit is buggy as hell;
it generates bogus warnings at every psql exit, for instance.

$ psql postgres
psql (13devel)
Type "help" for help.

postgres=# \q
could not save history to file "/Users/tgl/.psql_history": operating system error 0
$

It wouldn't be an unreasonable idea to desupport this version,
if it allowed additional simplifications in psql beside this
particular #ifdef mess. I'm not sure whether any of the
contortions in e.g. saveHistory could go away if we did so.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-12-12 10:22:21 BUG #16162: create index using gist_trgm_ops leads to panic
Previous Message Kyotaro Horiguchi 2019-12-12 03:48:56 Re: BUG #16159: recovery requests WALs for the next timelines before timeline switch LSN has been reached

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Khandekar 2019-12-12 06:04:10 Re: logical decoding : exceeded maxAllocatedDescs for .spill files
Previous Message Tom Lane 2019-12-12 05:31:52 Re: Collation versioning