Re: Support tab completion for upper character inputs in psql

From: David Zhang <david(dot)zhang(at)highgo(dot)ca>
To: "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "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-03-30 19:05:10
Message-ID: 3140db2a-9808-c470-7e60-de39c431b3ab@highgo.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tang,

Thanks a lot for the patch.

I did a quick test based on the latest patch V3 on latest master branch
"commit 4753ef37e0eda4ba0af614022d18fcbc5a946cc9".

Case 1: before patch

  1 postgres=# set a
  2 all                      allow_system_table_mods
application_name         array_nulls
  3 postgres=# set A
  4
  5 postgres=# create TABLE tbl (data text);
  6 CREATE TABLE
  7 postgres=# update tbl SET DATA =
  8
  9 postgres=# update T
 10
 11 postgres=#

Case 2: after patched

  1 postgres=# set a
  2 all                      allow_system_table_mods
application_name         array_nulls
  3 postgres=# set A
  4 ALL                      ALLOW_SYSTEM_TABLE_MODS
APPLICATION_NAME         ARRAY_NULLS
  5 postgres=# create TABLE tbl (data text);
  6 CREATE TABLE
  7
  8 postgres=# update tbl SET DATA =
  9
 10 postgres=# update TBL SET
 11
 12 postgres=#

So, as you can see the difference is between line 8 and 10 in case 2. It
looks like the lowercase can auto complete more than the uppercase;
secondly, if you can add some test cases, it would be great.

Best regards,
David

On 2021-03-22 5:41 a.m., tanghy(dot)fnst(at)fujitsu(dot)com wrote:
> On Tuesday, March 16, 2021 5:20 AM, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>
>> The cases that complete with a query
>> result are not case insensitive right now. This affects things like
>>
>> UPDATE T<tab>
>>
>> as well. I think your first patch was basically right. But we need to
>> understand that this affects all completions with query results, not
>> just the one you wanted to fix. So you should analyze all the callers
>> and explain why the proposed change is appropriate.
> Thanks for your review and suggestion. Please find attached patch V3 which was based on the first patch[1].
> Difference from the first patch is:
>
> Add tab completion support for all query results in psql.
> complete_from_query
> +complete_from_versioned_query
> +complete_from_schema_query
> +complete_from_versioned_schema_query
>
> [1] https://www.postgresql.org/message-id/a63cbd45e3884cf9b3961c2a6a95dcb7%40G08CNEXMBPEKD05.g08.fujitsu.local
>
> The modification to support case insensitive matching in " _complete_from_query" is based on "complete_from_const and "complete_from_list" .
> Please let me know if you find anything insufficient.
>
> Regards,
> Tang
>
>
--
David

Software Engineer
Highgo Software Inc. (Canada)
www.highgo.ca

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2021-03-30 19:05:51 Re: SELECT INTO deprecation
Previous Message Isaac Morland 2021-03-30 19:02:17 Re: Idea: Avoid JOINs by using path expressions to follow FKs