Re: [PATCH]Feature improvement for MERGE tab completion

bt22kawamotok <bt22kawamotok@oss.nttdata.com>

From: bt22kawamotok <bt22kawamotok@oss.nttdata.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Shinya Kato <Shinya11.Kato@oss.nttdata.com>, pgsql-hackers@postgresql.org
Date: 2022-09-14T09:12:52Z
Lists: pgsql-hackers

Attachments

> +	else if (TailMatches("MERGE", "INTO", MatchAny, "USING") ||
> +			 TailMatches("MERGE", "INTO", MatchAny, MatchAny, "USING") ||
> +			 TailMatches("MERGE", "INTO", MatchAny, "AS", MatchAny, "USING"))
>  		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables);
> 
> +	else if (TailMatches("MERGE", "INTO", MatchAny, "AS", MatchAny, 
> "USING") ||
> +			 TailMatches("MERGE", "INTO", MatchAny, MatchAny, "USING"))
>  		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables);
> 
> The latter seems redundant and can be removed. The former seems to
> cover all the cases where the latter covers.

> +	else if (TailMatches("USING", MatchAny, "ON", MatchAny) ||
> +			 TailMatches("USING", MatchAny, "ON", MatchAny,
> MatchAnyExcept("When"), MatchAnyExcept("When")) ||
> +			 TailMatches("USING", MatchAny, "AS", MatchAny, "ON", MatchAny) ||
> +			 TailMatches("USING", MatchAny, "AS", MatchAny, "ON", MatchAny,
> MatchAnyExcept("When"), MatchAnyExcept("When")) ||
> +			 TailMatches("USING", MatchAny, MatchAny, "ON", MatchAny) ||
> +			 TailMatches("USING", MatchAny, MatchAny, "ON", MatchAny,
> MatchAnyExcept("When"), MatchAnyExcept("When")))
> 
> "When" should be "WHEN"?
> 
> 
> Regards,

Thanks for reviewing.

Sorry for making such a simple mistake.
I fixed it in v6.

> Not only table but also view, foreign table, etc can be specified after
> USING in MERGE command. So ISTM that Query_for_list_of_selectables
> should be used at the above tab-completion, instead of 
> Query_for_list_of_tables.
> Thought?

That's nice idea!
I took that in v6.

Regards,

Kotaro Kawamoto

Commits

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

  2. psql: Improve tab-completion for MERGE.