pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shinya Kato <Shinya11.Kato@oss.nttdata.com>
To: bt22kawamotok <bt22kawamotok@oss.nttdata.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [PATCH]Feature improvement for MERGE tab completion
Date: Fri, 09 Sep 2022 20:55:43 +0900
Message-ID: <359a46c295eae938d84552c11818ab62@oss.nttdata.com> (raw)
In-Reply-To: <9f1ad2a87a58cd5e7d64f3993130958d@oss.nttdata.com>
References: <9f1ad2a87a58cd5e7d64f3993130958d@oss.nttdata.com>

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





view thread (21+ messages)  latest in thread

Message-ID: <359a46c295eae938d84552c11818ab62@oss.nttdata.com>
Permalink:  ../359a46c295eae938d84552c11818ab62@oss.nttdata.com/
Also on:    postgresql.org/message-id/359a46c295eae938d84552c11818ab62@oss.nttdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: Shinya11.Kato@oss.nttdata.com, bt22kawamotok@oss.nttdata.com
  Subject: Re: [PATCH]Feature improvement for MERGE tab completion
  In-Reply-To: <359a46c295eae938d84552c11818ab62@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox