Re: [PATCH]Feature improvement for MERGE tab completion

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема Re: [PATCH]Feature improvement for MERGE tab completion
Дата
Msg-id 23586a9b-8978-61dc-0531-03acff3a7b90@oss.nttdata.com
обсуждение исходный текст
Ответ на Re: [PATCH]Feature improvement for MERGE tab completion  (bt22kawamotok <bt22kawamotok@oss.nttdata.com>)
Ответы Re: [PATCH]Feature improvement for MERGE tab completion  (bt22kawamotok <bt22kawamotok@oss.nttdata.com>)
Список pgsql-hackers

On 2022/09/14 14:08, bt22kawamotok wrote:
>> When I tried to apply this patch, I got the following warning, please fix it.
>> Other than that, I think everything is fine.
>>
>> $ git apply fix_tab_completion_merge_v4.patch
>> fix_tab_completion_merge_v4.patch:38: trailing whitespace.
>>         else if (TailMatches("USING", MatchAny, "ON", MatchAny) ||
>> fix_tab_completion_merge_v4.patch:39: indent with spaces.
>>                  TailMatches("USING", MatchAny, "AS", MatchAny, "ON",
>> MatchAny) ||
>> fix_tab_completion_merge_v4.patch:40: indent with spaces.
>>                  TailMatches("USING", MatchAny, MatchAny, "ON", MatchAny))
>> fix_tab_completion_merge_v4.patch:53: trailing whitespace.
>>         else if (TailMatches("WHEN", "MATCHED") ||
>> warning: 4 lines add whitespace errors.
> 
> Thanks for reviewing.
> 
> I fixed the problem and make patch v5.
> Please check it.

Thanks for updating the patch!

+    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.


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?


+    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,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



В списке pgsql-hackers по дате отправления:

Предыдущее
От: bt22kawamotok
Дата:
Сообщение: Query jumbling for prepare statement
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: Query jumbling for prepare statement