Re: [PATCH]Feature improvement for MERGE tab completion

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: bt22kawamotok <bt22kawamotok(at)oss(dot)nttdata(dot)com>, Shinya Kato <Shinya11(dot)Kato(at)oss(dot)nttdata(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH]Feature improvement for MERGE tab completion
Date: 2022-09-18 05:29:30
Message-ID: 4522079f-256a-9756-7ece-f74fb702c85d@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
fix_tab_completion_merge_v8.patch text/plain 7.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-09-18 06:42:59 Re: Removed unused param isSlice of function transformAssignmentSubscripts
Previous Message Justin Pryzby 2022-09-18 04:53:07 Re: fix stats_fetch_consistency value in postgresql.conf.sample