Re: tab completion for partitioning

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tab completion for partitioning
Date: 2017-02-20 03:07:08
Message-ID: a77905fd-f0a5-d63b-f0e9-947bb9f8da6a@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017/02/20 1:22, Robert Haas wrote:
> On Thu, Feb 16, 2017 at 7:15 AM, Amit Langote
> <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>> Also attaching 0002 (unchanged) for tab-completion support for the new
>> partitioning syntax.
>
> At one point you have this:
>
> + /* Limited completion support for partition bound specification */
> + else if (TailMatches3("ATTACH", "PARTITION", MatchAny))
> + COMPLETE_WITH_CONST("FOR VALUES");
> + else if (TailMatches5("ATTACH", "PARTITION", MatchAny, "FOR", "VALUES"))
> + COMPLETE_WITH_LIST2("FROM (", "IN (");
> + /*
>
> And then later on you have it again:
>
> + /* Limited completion support for partition bound specification */
> + else if (TailMatches3("PARTITION", "OF", MatchAny))
> + COMPLETE_WITH_CONST("FOR VALUES");
> + else if (TailMatches5("PARTITION", "OF", MatchAny, "FOR", "VALUES"))
> + COMPLETE_WITH_LIST2("FROM (", "IN (");
>
> I don't think there's any benefit in repeating this. I'm not sure
> which location to keep, but it doesn't seem to make sense to have it
> in two places.

Thanks for taking a look. Hm, I think the second part seems to be
needless duplication. So, I changed it to match using TailMatches2("FOR",
"VALUES") and kept just one instance of it. The first part is matching
and completing two different commands (ATTACH PARTITION partition_name and
PARTITION OF parent_name), so that seems fine.

Updated patch attached.

Thanks,
Amit

Attachment Content-Type Size
0001-Tab-completion-for-the-new-partitioning-syntax.patch text/x-diff 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-02-20 04:02:53 Re: Adding new output parameter of pg_stat_statements to identify operation of the query.
Previous Message Jim Nasby 2017-02-20 02:35:12 Re: GUC for cleanup indexes threshold.