Re: [PATCH]Feature improvement for MERGE tab completion
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: bt22kawamotok <bt22kawamotok@oss.nttdata.com>,
Shinya Kato <Shinya11.Kato@oss.nttdata.com>
Cc: pgsql-hackers@postgresql.org
Date: 2022-09-18T05:29:30Z
Lists: pgsql-hackers
Attachments
- fix_tab_completion_merge_v8.patch (text/plain) patch v8
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
Commits
-
Push lpp variable closer to usage in heapgetpage()
- e351f8541831 16.0 cited
-
psql: Improve tab-completion for MERGE.
- f80919df950a 15.0 landed
- 9a6915257d1d 16.0 landed