Re: [PATCH]Feature improvement for MERGE tab completion - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: [PATCH]Feature improvement for MERGE tab completion
Date
Msg-id 4522079f-256a-9756-7ece-f74fb702c85d@oss.nttdata.com
Whole thread Raw
In response to Re: [PATCH]Feature improvement for MERGE tab completion  (bt22kawamotok <bt22kawamotok@oss.nttdata.com>)
Responses Re: [PATCH]Feature improvement for MERGE tab completion
List pgsql-hackers

On 2022/09/16 11:46, bt22kawamotok wrote:
>> Thanks for updating.
>>
>> +        COMPLETE_WITH("UPDATE", "DELETE", "DO NOTHING");
>>
>> "UPDATE" is always followed by "SET",  so why not complement it with
>> "UPDATE SET"?
> 
> Thanks for reviewing.
> That's a good idea!
> I create new patch v7.

Thanks for updating the patch!

I applied the following changes to the patch. Attached is the updated version of the patch.

The tab-completion code for MERGE was added in the middle of that for LOCK TABLE.
This would be an oversight of the commit that originally supported tab-completion
for MERGE. I fixed this issue.

+    else if (TailMatches("MERGE", "INTO", MatchAny, "AS", MatchAny) ||
+             TailMatches("MERGE", "INTO", MatchAny, MatchAnyExcept("AS")))
          COMPLETE_WITH("USING");

This can cause to complete "MERGE INTO <table> USING" with "USING" unexpectedly.
I fixed this issue by replacing MatchAnyExcept("AS") with MatchAnyExcept("USING|AS").

I added some comments.

"MERGE" was tab-completed with just after "EXPLAIN" or "EXPLAIN ANALYZE", etc.
Since "INTO" always follows "MERGE", it's better to complete with "MERGE INTO"
there. I replaced "MERGE" with "MERGE INTO" in those tab-completions.

Regards,

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

pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: fix stats_fetch_consistency value in postgresql.conf.sample
Next
From: Michael Paquier
Date:
Subject: Re: Removed unused param isSlice of function transformAssignmentSubscripts