Re: [HACKERS] Improve tab completion for REFRESH MATERIALIZED VIEW

2016-01-26 Thread Michael Paquier
On Tue, Jan 26, 2016 at 9:52 PM, Masahiko Sawada  wrote:
> Tab completion for REFRESH command is oddly with following scenario.
>
> =# REFRESH MATERIALIZED VIEW CONCURRENTLY hoge_mv [Tab]
>
> It shows only WITH DATA option without WITH NO DATA option.
> Attached patch improves tab completion for WITH DATA/NO DATA option of
> REFRESH MATERIALIZED VIEW.

Correct. Nice catch and good patch.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improve tab completion for REFRESH MATERIALIZED VIEW

2016-01-26 Thread Fujii Masao
On Tue, Jan 26, 2016 at 10:25 PM, Michael Paquier
 wrote:
> On Tue, Jan 26, 2016 at 9:52 PM, Masahiko Sawada  
> wrote:
>> Tab completion for REFRESH command is oddly with following scenario.
>>
>> =# REFRESH MATERIALIZED VIEW CONCURRENTLY hoge_mv [Tab]
>>
>> It shows only WITH DATA option without WITH NO DATA option.
>> Attached patch improves tab completion for WITH DATA/NO DATA option of
>> REFRESH MATERIALIZED VIEW.
>
> Correct. Nice catch and good patch.

The patch looks good to me.

While testing the patch, I found that
REFRESH MATERIALIZED VIEW  doesn't list the materialized views.
I added the following change to the patch to fix that problem. Patch attached.

-   {"MATERIALIZED VIEW", NULL, NULL},
+   {"MATERIALIZED VIEW", NULL, _for_list_of_matviews},

Regards,

-- 
Fujii Masao


improve_tab_completion_for_refresh_v2.patch
Description: Binary data

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improve tab completion for REFRESH MATERIALIZED VIEW

2016-01-26 Thread Fujii Masao
On Tue, Jan 26, 2016 at 11:08 PM, Fujii Masao  wrote:
> On Tue, Jan 26, 2016 at 10:25 PM, Michael Paquier
>  wrote:
>> On Tue, Jan 26, 2016 at 9:52 PM, Masahiko Sawada  
>> wrote:
>>> Tab completion for REFRESH command is oddly with following scenario.
>>>
>>> =# REFRESH MATERIALIZED VIEW CONCURRENTLY hoge_mv [Tab]
>>>
>>> It shows only WITH DATA option without WITH NO DATA option.
>>> Attached patch improves tab completion for WITH DATA/NO DATA option of
>>> REFRESH MATERIALIZED VIEW.
>>
>> Correct. Nice catch and good patch.
>
> The patch looks good to me.
>
> While testing the patch, I found that
> REFRESH MATERIALIZED VIEW  doesn't list the materialized views.

This is not true. Sorry for the noise...

Regards,

-- 
Fujii Masao


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improve tab completion for REFRESH MATERIALIZED VIEW

2016-01-26 Thread Kevin Grittner
On Tue, Jan 26, 2016 at 8:24 AM, Fujii Masao  wrote:
> On Tue, Jan 26, 2016 at 11:08 PM, Fujii Masao  wrote:

>> While testing the patch, I found that
>> REFRESH MATERIALIZED VIEW  doesn't list the materialized views.
>
> This is not true. Sorry for the noise...

But CREATE MATERIALIZED VIEW  doesn't list existing matviews.
I'm not clear on why it's a good idea to do so, but most kinds of
objects (including tables, views, and indexes) do so; so it seems
best to follow suit here.  I will push something shortly with the
improvements from both of you, plus a couple other MV tab
completion issues I found in testing these patches.

-- 
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improve tab completion for REFRESH MATERIALIZED VIEW

2016-01-26 Thread Kevin Grittner
On Tue, Jan 26, 2016 at 8:43 AM, Kevin Grittner  wrote:

> I will push something shortly with the
> improvements from both of you, plus a couple other MV tab
> completion issues I found in testing these patches.

Done.

-- 
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improve tab completion for REFRESH MATERIALIZED VIEW

2016-01-26 Thread Fujii Masao
On Tue, Jan 26, 2016 at 11:49 PM, Kevin Grittner  wrote:
> On Tue, Jan 26, 2016 at 8:43 AM, Kevin Grittner  wrote:
>
>> I will push something shortly with the
>> improvements from both of you, plus a couple other MV tab
>> completion issues I found in testing these patches.
>
> Done.

But ISTM that CREATE MATERIALIZED VIEW  doesn't list
existing matviews yet. What's worse it lists existing *views*.

This happens because words_after_create mechanism doesn't support
the case where the keyword has more than one words like "MATERIALIZED VIEW".
Probably we should improve that mechanism so that even multiple words can be
handled. Or we should just add something like the following.

   /* Complete CREATE MATERIALIZED VIEW with  */
+   else if (Matches3("CREATE", "MATERIALIZED", "VIEW"))
+   COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews, NULL);


Regards,

-- 
Fujii Masao


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Improve tab completion for REFRESH MATERIALIZED VIEW

2016-01-26 Thread Michael Paquier
On Wed, Jan 27, 2016 at 11:41 AM, Fujii Masao  wrote:
> But ISTM that CREATE MATERIALIZED VIEW  doesn't list
> existing matviews yet. What's worse it lists existing *views*.

Yep.

> This happens because words_after_create mechanism doesn't support
> the case where the keyword has more than one words like "MATERIALIZED VIEW".

Having worked on that, I am not convinced this is worth the complication.

> Probably we should improve that mechanism so that even multiple words can be
> handled. Or we should just add something like the following.
>
>/* Complete CREATE MATERIALIZED VIEW with  */
> +   else if (Matches3("CREATE", "MATERIALIZED", "VIEW"))
> +   COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews, NULL);

Indeed, we do the same for tables and views as well. That would be fine.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Improve tab completion for REFRESH MATERIALIZED VIEW

2016-01-26 Thread Masahiko Sawada
Hi all,

Tab completion for REFRESH command is oddly with following scenario.

=# REFRESH MATERIALIZED VIEW CONCURRENTLY hoge_mv [Tab]

It shows only WITH DATA option without WITH NO DATA option.
Attached patch improves tab completion for WITH DATA/NO DATA option of
REFRESH MATERIALIZED VIEW.


Regards,

--
Masahiko Sawada


improve_tab_completion_for_refresh.patch
Description: binary/octet-stream

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers