postgresql/config
Tom Lane cd69ec66c8 Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how to
tab-complete filenames, but it turns out that that doesn't work too well
unless we follow its expectation that we use its filename quoting hooks
to quote and de-quote filenames.  We were trying to do such quote handling
within complete_from_files(), and that's still what we have to do if we're
using libedit, which lacks those hooks.  But for Readline, it works a lot
better if we tell Readline that single-quote is a quoting character and
then provide hooks that know the details of the quoting rules for SQL
and psql meta-commands.

Hence, resurrect the quoting hook functions that existed in the original
version of tab-complete.c (and were disabled by commit f6689a328 because
they "didn't work so well yet"), and whack on them until they do seem to
work well.

Notably, this fixes bug #16059 from Steven Winfield, who pointed out
that the previous coding would strip quote marks from filenames in SQL
COPY commands, even though they're syntactically necessary there.
Now, we not only don't do that, but we'll add a quote mark when you
tab-complete, even if you didn't type one.

Getting this to work across a range of libedit versions (and, to a
lesser extent, libreadline versions) was depressingly difficult.
It will be interesting to see whether the new regression test cases
pass everywhere in the buildfarm.

Some future patch might try to handle quoted SQL identifiers with
similar explicit quoting/dequoting logic, but that's for another day.

Patch by me, reviewed by Peter Eisentraut.

Discussion: https://postgr.es/m/16059-8836946734c02b84@postgresql.org
2020-01-23 11:07:12 -05:00
..
Makefile Install our "missing" script where PGXS builds can find it. 2015-12-11 16:15:05 -05:00
ac_func_accept_argtypes.m4 Reorder configure tests for accept() in Windows 2019-03-04 14:42:12 -05:00
ax_prog_perl_modules.m4 Make configure check for IPC::Run when --enable-tap-tests is specified. 2017-06-15 15:56:12 -04:00
ax_pthread.m4 Update config/ax_pthread.m4 to latest upstream version. 2018-11-19 15:05:33 -05:00
c-compiler.m4 Make use of compiler builtins and/or assembly for CLZ, CTZ, POPCNT. 2019-02-15 23:22:33 -05:00
c-library.m4 Simplify PGAC_STRUCT_TIMEZONE Autoconf macro 2019-10-07 16:47:23 +02:00
check_decls.m4 Fix configure's AC_CHECK_DECLS tests to work correctly with clang. 2018-11-19 12:01:47 -05:00
config.guess Update config.guess and config.sub 2019-04-27 14:25:00 +02:00
config.sub Update config.guess and config.sub 2019-04-27 14:25:00 +02:00
docbook.m4 Convert documentation to DocBook XML 2017-11-23 09:44:28 -05:00
general.m4 Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
install-sh Fix install-strip on Mac OS X 2012-08-21 23:42:43 -04:00
libtool.m4 Rename AC_PROG_LD* macros to PGAC_PROG_LD*. This avoids clashes with the 2004-07-17 18:53:56 +00:00
llvm.m4 Use better comment marker in Autoconf input 2019-02-09 15:55:17 +01:00
missing Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
perl.m4 configure: More use of AC_ARG_VAR 2019-01-18 08:38:34 +01:00
pkg.m4 ICU support 2017-03-23 15:28:48 -04:00
prep_buildtree Fix vpath build 2019-03-27 23:36:00 +01:00
programs.m4 Improve psql's tab completion for filenames. 2020-01-23 11:07:12 -05:00
python.m4 Remove support for Python older than 2.6 2020-01-08 22:47:22 +01:00
tcl.m4 configure: More use of AC_ARG_VAR 2019-01-18 08:38:34 +01:00