I wrote: > Alvaro Herrera <alvhe...@2ndquadrant.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