]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix psql's tab-completion of enum label values.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Jan 2022 19:59:20 +0000 (14:59 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Jan 2022 19:59:20 +0000 (14:59 -0500)
commit90a847e6dcc8fcf8d6f0eaf7b8022153d3b0f184
treef07ca8dde80ed057c4eb559694299cddc3031912
parentd6817032d26becd3c49f11d16efd6012e2139fc4
Fix psql's tab-completion of enum label values.

Since enum labels have to be single-quoted, this part of the
tab completion machinery got side-swiped by commit cd69ec66c.
A side-effect of that commit is that (at least with some versions
of Readline) the text string passed for completion will omit the
leading quote mark of the enum label literal.  Libedit still acts
the same as before, though, so adapt COMPLETE_WITH_ENUM_VALUE so
that it can cope with either convention.

Also, when we fail to find any valid completion, set
rl_completion_suppress_quote = 1.  Otherwise readline will
go ahead and append a closing quote, which is unwanted.

Per report from Peter Eisentraut.  Back-patch to v13 where
cd69ec66c came in.

Discussion: https://postgr.es/m/8ca82d89-ec3d-8b28-8291-500efaf23b25@enterprisedb.com
src/bin/psql/t/010_tab_completion.pl
src/bin/psql/tab-complete.c