From: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Japin Li <japinli(at)hotmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "smithpb2250(at)gmail(dot)com" <smithpb2250(at)gmail(dot)com>, "david(dot)zhang(at)highgo(dot)ca" <david(dot)zhang(at)highgo(dot)ca>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Support tab completion for upper character inputs in psql |
Date: | 2022-02-01 13:15:45 |
Message-ID: | 87wniezq0u.fsf@wibble.ilmari.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> I wrote:
>> =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= <ilmari(at)ilmari(dot)org> writes:
>>> First, as noted in the test, it doesn't preserve the case of the input
>>> for keywords appended to the query result. This is easily fixed by
>>> using `pg_strdup_keyword_case()`, per the first attached patch.
>
>> I thought about that, and intentionally didn't do it, because it
>> would also affect the menus produced by tab completion.
>> ...
>> We could do something hacky like matching case only when there's
>> no longer any matching object names, but that might be too magic.
>
> I experimented with that, and it actually doesn't seem as weird
> as I feared. See if you like this ...
That's a reasonable compromise, and the implementation is indeed less
hacky than one might have feared. Although I think putting the
`num_keywords` variable before `num_other` would read better.
Going through the uses of COMPLETE_WITH(_SCHEMA)_QUERY_PLUS, I noticed a
few that had the keywords in lower case, which is fixed in the attached
patch (except the hardcoded data types, which aren't really keywords).
While I was there, I also added completion of "AUTHORIZATION" after
"SHOW SESSSION", which is necessary since there are variables starting
with "session_".
> regards, tom lane
Cheers,
- ilmari
Attachment | Content-Type | Size |
---|---|---|
0001-Make-all-tab-completion-keywords-upper-case.patch | text/x-diff | 2.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | gkokolatos | 2022-02-01 13:36:05 | Plug minor memleak in pg_dump |
Previous Message | Bharath Rupireddy | 2022-02-01 13:03:24 | Re: Add checkpoint and redo LSN to LogCheckpointEnd log message |