From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>, Tim Cross <theophilusx(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: psql UPDATE field [tab] expands to DEFAULT? |
Date: | 2019-06-25 15:59:56 |
Message-ID: | 1702.1561478396@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
I wrote:
> I took a closer look and realized that this isn't some magic behavior of
> arcane parts of libreadline; it's more like self-inflicted damage. It
> happens because tab-complete.c's complete_from_const() is doing exactly
> what its comment says it does:
> /*
> * This function returns one fixed string the first time even if it doesn't
> * match what's there, and nothing the second time. This should be used if
> * there is only one possibility that can appear at a certain spot, so
> * misspellings will be overwritten. The string to be passed must be in
> * completion_charp.
> */
> This is unlike complete_from_list(), which will only return completions
> that match the text-string-so-far.
> I have to wonder whether complete_from_const()'s behavior is really
> a good idea; I think there might be an argument for getting rid of it
> and using complete_from_list() even for one-element lists.
I experimented with ripping out complete_from_const() altogether, and
soon found that there's still one place where we need it: down at the
end of psql_completion, where we've failed to find any useful completion.
If that instance of COMPLETE_WITH("") is implemented by complete_from_list
then readline will happily try to do filename completion :-(.
(I don't quite understand why we don't get the wiping-out behavior there;
maybe an empty-string result is treated differently from
not-empty-string?)
So I propose the attached instead, which doesn't get rid of
complete_from_const but ensures that it's only used in that one place.
This is independent of the other patch shown upthread. I'm proposing
this one for HEAD only but would back-patch the other.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
avoid-complete-from-const.patch | text/x-diff | 2.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Brannen | 2019-06-25 21:02:35 | RE: Need a DB layout gui |
Previous Message | Pawan Sharma | 2019-06-25 14:43:28 | Re: Connect is not available, request timeout after 30000ms. |
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2019-06-25 16:02:35 | Re: [PATCH] Incremental sort (was: PoC: Partial sort) |
Previous Message | Liudmila Mantrova | 2019-06-25 15:38:27 | Re: SQL/JSON path issues/questions |