Re: [PATCH] Added TRANSFORM FOR for COMMENT tab completion

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Shinya Kato <Shinya11(dot)Kato(at)oss(dot)nttdata(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Ken Kato <katouknl(at)oss(dot)nttdata(dot)com>, Suraj Khamkar <khamkarsuraj(dot)b(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Added TRANSFORM FOR for COMMENT tab completion
Date: 2021-11-01 15:26:10
Message-ID: 047d4744-3290-5ea4-685a-ab4882a5290b@oss.nttdata.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/10/27 15:54, Shinya Kato wrote:
> On 2021-10-27 14:45, Michael Paquier wrote:
>> On Tue, Oct 26, 2021 at 05:04:24PM +0900, Shinya Kato wrote:
>>> Barring any objection, I will change status to Ready for Committer.
>>
>> +   else if (Matches("COMMENT", "ON", "PROCEDURAL"))
>> +       COMPLETE_WITH("LANGUAGE");
>> +   else if (Matches("COMMENT", "ON", "PROCEDURAL", "LANGUAGE"))
>> +       COMPLETE_WITH_QUERY(Query_for_list_of_languages);
>> I don't think that there is much point in being this picky either with
>> the usage of PROCEDURAL, as we already complete a similar and simpler
>> grammar with LANGUAGE.  I would just remove this part of the patch.
> In my opinion, it is written in the documentation, so tab-completion of "PROCEDURAL"is good.
> How about a completion with "LANGUAGE" and "PROCEDURAL LANGUAGE", like "PASSWORD" and "ENCRYPTED PASSWORD" in CREATE ROLE?
>
>> +   else if (Matches("COMMENT", "ON", "OPERATOR"))
>> +       COMPLETE_WITH("CLASS", "FAMILY");
>> Isn't this one wrong?  Operators can have comments, and we'd miss
>> them.  This is mentioned upthread, but it seems to me that we'd better
>> drop this part of the patch if the operator naming part cannot be
>> solved easily.
> As you said, it may be misleading.
> I agree to drop it.

So I changed the status of the patch to Waiting on Author in CF.

+static const SchemaQuery Query_for_list_of_text_search_configurations = {

We already have Query_for_list_of_ts_configurations in tab-complete.c.
Do we really need both queries? Or we can drop either of them?

+#define Query_for_list_of_operator_class_index_methods \
+"SELECT pg_catalog.quote_ident(amname)"\
+" FROM pg_catalog.pg_am"\
+" WHERE (%d = pg_catalog.length('%s'))"\
+" AND oid IN "\
+" (SELECT opcmethod FROM pg_catalog.pg_opclass "\
+" WHERE pg_catalog.quote_ident(opcname)='%s')"

Isn't it overkill to tab-complete this? I thought that because
I'm not sure if COMMENT command for OPERATOR CLASS or FAMILY is
usually executed via psql interactively, instead I just guess
it's executed via script. Also because there is no tab-completion
support for ALTER OPERATOR CLASS or FAMILY command. It's a bit
strange to support the tab-complete for COMMENT for OPERATOR CLASS
or FAMILY first.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2021-11-01 15:33:21 enabling FOO=bar arguments to vcregress.pl
Previous Message Tomas Vondra 2021-11-01 15:03:08 Re: Feature request for adoptive indexes