Re: Support tab completion for upper character inputs in psql

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-01-31 01:28:45
Message-ID: 8735l41ynm.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:

> "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com> writes:
>> Thanks for your V16 patch, I tested it.
>> The results LGTM.
>
> Pushed, thanks for looking.

I wasn't following this thread, but I noticed a few small potential
improvements when I saw the commit.

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.

The second might be more of a matter of style or opinion, but I noticed
a bunch of `if (foo) free(foo);`, which is redundant given that
`free(NULL)` is a no-op. To simplify the code further, I also made
`escape_string(NULL)` be a no-op, returning `NULL`.

- ilmari

Attachment Content-Type Size
0001-Respect-COMP_KEYWORD_CASE-for-additional-keywords.patch text/x-diff 2.3 KB
0002-psql-tab-complete-remove-unnecessary-null-checks.patch text/x-diff 2.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2022-01-31 01:50:45 Re: Is there a way (except from server logs) to know the kind of on-going/last checkpoint?
Previous Message Mark Dilger 2022-01-31 01:11:48 Re: CREATEROLE and role ownership hierarchies