Re: Several problems in tab-completions for SET/RESET

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Several problems in tab-completions for SET/RESET
Date: 2016-01-28 13:50:00
Message-ID: CAD21AoDPGH+6RxQoFUwXAnU_CvYWvKV0eA+fxuX+eK5QtbLYag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 28, 2016 at 10:15 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Thu, Jan 28, 2016 at 9:32 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>> I found that the following tab-completions for SET/RESET which
>> worked properly before doesn't work properly now in the master.
>>
>> 1. ALTER SYSTEM SET|RESET <tab> lists nothing.
>> 2. ALTER DATABASE xxx SET <tab> lists nothing.
>> 3. ALTER DATABASE xxx SET yyy <tab> lists nothing.
>> 4. ALTER DATABASE xxx SET datestyle TO <tab> lists nothing.
>>
>> Attached patch fixes those problems.
>
> - else if (Matches4("ALTER", "SYSTEM", "SET|RESET", MatchAny))
> + else if (Matches3("ALTER", "SYSTEM", "SET|RESET"))
> Good catch.
>
> - else if (Matches2("SET", MatchAny))
> + else if (TailMatches2("SET", MatchAny) &&
> + !TailMatches4("UPDATE|DOMAIN", MatchAny,
> MatchAny, MatchAny) &&
> + !TailMatches1("TABLESPACE|SCHEMA") &&
> + !ends_with(prev_wd, ')') &&
> + !ends_with(prev_wd, '='))
> COMPLETE_WITH_CONST("TO");

This change breaks tab completion for ALTER TABLE ... SET
[WITH/LOGGED/UNLOGGED].

It think it should be
> + else if (Matches2("SET", MatchAny) &&

Related to it, I found tab completion for ALTER TABLE .. SET WITH,
which doesn't working well.
Patch is attached.

Regards,

--
Masahiko Sawada

Attachment Content-Type Size
tab_completion_for_alter_table_set_with.patch text/x-patch 608 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anastasia Lubennikova 2016-01-28 14:06:57 Re: [WIP] Effective storage of duplicates in B-tree index.
Previous Message Amit Langote 2016-01-28 13:41:40 Re: [PROPOSAL] VACUUM Progress Checker.