Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWcbw-0004wQ-JI for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Sep 2022 11:55:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oWcbv-0002jd-E3 for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Sep 2022 11:55:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWcbv-0002jR-4q for pgsql-hackers@lists.postgresql.org; Fri, 09 Sep 2022 11:55:51 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWcbs-0007xz-I6 for pgsql-hackers@postgresql.org; Fri, 09 Sep 2022 11:55:50 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id 9E2006090D; Fri, 9 Sep 2022 20:55:43 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.7 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 09 Sep 2022 20:55:43 +0900 From: Shinya Kato To: bt22kawamotok Cc: pgsql-hackers@postgresql.org Subject: Re: [PATCH]Feature improvement for MERGE tab completion In-Reply-To: <9f1ad2a87a58cd5e7d64f3993130958d@oss.nttdata.com> References: <9f1ad2a87a58cd5e7d64f3993130958d@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <359a46c295eae938d84552c11818ab62@oss.nttdata.com> X-Sender: Shinya11.Kato@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 " is typed, "MATCHED" and "NOT MATCHED" is > not completed. > There is also a problem that typing "MERGE INTO a AS " 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