Re: [PATCH]Feature improvement for MERGE tab completion

Поиск
Список
Период
Сортировка
От vignesh C
Тема Re: [PATCH]Feature improvement for MERGE tab completion
Дата
Msg-id CALDaNm0RS6-_osaojxD3Ks6kS8zg5KzOo3aRV15pOVFMC_tyag@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH]Feature improvement for MERGE tab completion  (Fujii Masao <masao.fujii@oss.nttdata.com>)
Ответы Re: [PATCH]Feature improvement for MERGE tab completion
Список pgsql-hackers
On Wed, 21 Sept 2022 at 10:55, Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>
>
>
> 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);

The patch does not apply on top of HEAD as in [1], please post a rebased patch:
=== Applying patches on top of PostgreSQL commit ID
e351f85418313e97c203c73181757a007dfda6d0 ===
=== applying patch ./v9-0001-psql-Improve-tab-completion-for-MERGE.patch
patching file src/bin/psql/tab-complete.c
Hunk #1 FAILED at 1669.
Hunk #2 FAILED at 3641.
Hunk #3 FAILED at 3660.
Hunk #4 FAILED at 4065.
4 out of 4 hunks FAILED -- saving rejects to file
src/bin/psql/tab-complete.c.rej

[1] - http://cfbot.cputube.org/patch_41_3890.log

Regards,
Vignesh



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

Предыдущее
От: vignesh C
Дата:
Сообщение: Re: [PATCH] Expand character set for ltree labels
Следующее
От: vignesh C
Дата:
Сообщение: Re: MultiXact\SLRU buffers configuration