Re: [PATCH]Feature improvement for MERGE tab completion
От | Fujii Masao |
---|---|
Тема | Re: [PATCH]Feature improvement for MERGE tab completion |
Дата | |
Msg-id | 5ed05370-d694-1ea3-045f-01dce952b326@oss.nttdata.com обсуждение исходный текст |
Ответ на | [PATCH]Feature improvement for MERGE tab completion (bt22kawamotok <bt22kawamotok@oss.nttdata.com>) |
Ответы |
Re: [PATCH]Feature improvement for MERGE tab completion
Re: [PATCH]Feature improvement for MERGE tab completion |
Список | pgsql-hackers |
On 2022/09/21 0:51, Alvaro Herrera wrote: > The rules starting at line 4111 make me a bit nervous, since nowhere > we're restricting them to operating only on MERGE lines. I don't think > it's a real problem since USING is not terribly common anyway. Likewise > for the ones with WHEN [NOT] MATCHED. I kinda wish we had a way to > search for stuff like "keyword MERGE appears earlier in the command", > but we don't have that. Yeah, I was thinking the same when updating the patch. How about adding something like PartialMatches() that checks whether the keywords are included in the input string or not? If so, we can restrict some tab-completion rules to operating only on MERGE, as follows. I attached the WIP patch (0002 patch) that introduces PartialMatches(). Is this approach over-complicated? Thought? + else if (PartialMatches("MERGE", "INTO", MatchAny, "USING") || + PartialMatches("MERGE", "INTO", MatchAny, "AS", MatchAny, "USING") || + PartialMatches("MERGE", "INTO", MatchAny, MatchAny, "USING")) + { + /* Complete MERGE INTO ... ON with target table attributes */ + if (TailMatches("INTO", MatchAny, "USING", MatchAny, "ON")) + COMPLETE_WITH_ATTR(prev4_wd); + else if (TailMatches("INTO", MatchAny, "AS", MatchAny, "USING", MatchAny, "AS", MatchAny, "ON")) + COMPLETE_WITH_ATTR(prev8_wd); + else if (TailMatches("INTO", MatchAny, MatchAny, "USING", MatchAny, MatchAny, "ON")) + COMPLETE_WITH_ATTR(prev6_wd); Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION
Вложения
В списке pgsql-hackers по дате отправления: