Re: [PATCH]Feature improvement for MERGE tab completion

From: Shinya Kato <Shinya11(dot)Kato(at)oss(dot)nttdata(dot)com>
To: bt22kawamotok <bt22kawamotok(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-09 11:55:43
Message-ID: 359a46c295eae938d84552c11818ab62@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022-09-09 11:18, bt22kawamotok wrote:

> I created a patch for improving MARGE tab completion.
> Currently there is a problem with "MERGE INTO dst as d Using src as s
> ON d.key = s.key WHEN <tab>" is typed, "MATCHED" and "NOT MATCHED" is
> not completed.
> There is also a problem that typing "MERGE INTO a AS <tab>" completes
> "USING".
> This patch solves the above problems.

Thanks for the patch!

else if (TailMatches("USING", MatchAny, "ON", MatchAny, "WHEN"))
COMPLETE_WITH("MATCHED", "NOT MATCHED");
else if (TailMatches("USING", MatchAny, "AS", MatchAny, "ON", MatchAny,
"WHEN"))
COMPLETE_WITH("MATCHED", "NOT MATCHED");
else if (TailMatches("USING", MatchAny, MatchAny, "ON", MatchAny,
"WHEN"))
COMPLETE_WITH("MATCHED", "NOT MATCHED");

I thought it would be better to describe this section as follows,
summarizing the conditions

else if (TailMatches("USING", MatchAny, "ON", MatchAny, "WHEN") ||
TailMatches("USING", MatchAny, "AS", MatchAny, "ON", MatchAny,
"WHEN") ||
TailMatches("USING", MatchAny, MatchAny, "ON", MatchAny, "WHEN"))
COMPLETE_WITH("MATCHED", "NOT MATCHED");

There are similar redundancies in the tab completion of MERGE statement,
so why not fix that as well?

--
Regards,

--
Shinya Kato
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 Alvaro Herrera 2022-09-09 11:58:39 Re: MERGE and parsing with prepared statements
Previous Message Alvaro Herrera 2022-09-09 11:54:25 Re: Doc fix and adjustment for MERGE command