Re: [PATCH]Feature improvement for MERGE tab completion

bt22kawamotok <bt22kawamotok@oss.nttdata.com>

From: bt22kawamotok <bt22kawamotok@oss.nttdata.com>
To: Shinya Kato <Shinya11.Kato@oss.nttdata.com>
Cc: pgsql-hackers@postgresql.org
Date: 2022-09-12T06:53:46Z
Lists: pgsql-hackers

Attachments

> 	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?

Thanks for your review.

A new patch has been created to reflect the changes you indicated.
I also found a problem that "DO NOTHING" is not completed when type 
"WHEN MATCHED <tab>", so I fixed it as well.

Regards,

Kotaro Kawamoto

Commits

  1. Push lpp variable closer to usage in heapgetpage()

  2. psql: Improve tab-completion for MERGE.