RE: Support tab completion for upper character inputs in psql

From: "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, David Zhang <david(dot)zhang(at)highgo(dot)ca>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "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: 2021-04-22 12:43:42
Message-ID: OS0PR01MB61131A4347D385F02F60E123FB469@OS0PR01MB6113.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wednesday, April 21, 2021 1:24 PM, Peter Smith <smithpb2250(at)gmail(dot)com> Wrote

>I tried playing a bit with your psql patch V5 and I did not find any
>problems - it seemed to work as advertised.
>
>Below are a few code review comments.

Thanks for you review. I've updated the patch to V6 according to your comments.

>1. Patch applies with whitespace warnings.
Fixed.

>2. Unrelated "code tidy" fixes maybe should be another patch?
Agreed. Will post this modification on another thread.

>3. Unnecessary NULL check?
Agreed. NULL check removed.

>4. Memory not freed in multiple places?
oops. Memory free added.

>5. strncmp replacement?
Agreed. Thanks for your advice. Since this modification has little relation with my patch here.
I will merge this with comment(2) and push this on another patch.

>6. byte_length == 0?
>The byte_length was not being checked before, so why is the check needed now?

We need to make sure the empty input to be case sensitive as before(HEAD).
For example
CREATE TABLE onetab1 (f1 int);
update onetab1 SET [tab]

Without the check of "byte_length == 0", pg_strdup_keyword_case will make the column name "f1" to be upper case "F1".
Namely, the output will be " update onetab1 SET F1" which is not so good.

I added some tab tests for this empty input case, too.

>7. test typo "ralation"
>8. test typo "case-insensitiveq"
Thanks, typo fixed.

Any further comment is very welcome.

Regards,
Tang

Attachment Content-Type Size
V6-0001-Support-tab-completion-with-a-query-result-for-upper.patch application/octet-stream 6.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tanghy.fnst@fujitsu.com 2021-04-22 12:44:28 use pg_strncasecmp to replace strncmp when compare "pg_"
Previous Message Amit Langote 2021-04-22 12:17:08 Re: posgres 12 bug (partitioned table)