Re: [PATCH] Added TRANSFORM FOR for COMMENT tab completion - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: [PATCH] Added TRANSFORM FOR for COMMENT tab completion
Date
Msg-id 047d4744-3290-5ea4-685a-ab4882a5290b@oss.nttdata.com
Whole thread Raw
In response to Re: [PATCH] Added TRANSFORM FOR for COMMENT tab completion  (Shinya Kato <Shinya11.Kato@oss.nttdata.com>)
Responses Re: [PATCH] Added TRANSFORM FOR for COMMENT tab completion
List 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



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Feature request for adoptive indexes
Next
From: Andrew Dunstan
Date:
Subject: enabling FOO=bar arguments to vcregress.pl