Re: adding tab completions

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Arthur Zakirov <a.zakirov@postgrespro.ru>
Cc: Edmund Horner <ejrh00@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2018-06-27T20:10:51Z
Lists: pgsql-hackers

Attachments

On Mon, Jun 11, 2018 at 11:35:51PM +0300, Arthur Zakirov wrote:
> IMHO, I'd leave the code as simple as possible. It is up to you of
> course. But it is easy to add completion for a first attribute, by
> adding the condition (and leave other attributes without completion):
> 
> else if (HeadMatches1("VACUUM") && TailMatches1("("))
>     COMPLETE_WITH_ATTR(prev2_wd, "");

Thanks - I've done this in the attached.  It works well for having minimal
logic.

On Tue, Jun 05, 2018 at 05:29:42PM +0300, Arthur Zakirov wrote:
> On Sun, Jun 03, 2018 at 10:39:22PM -0500, Justin Pryzby wrote:
> > else if (HeadMatches1("EXPLAIN") && previous_words_count==2 && prev_wd[0]=='(' && ends_with(prev_wd, ')'))
> 
> I think this condition can be replaced by:
> 
> else if (TailMatches2("EXPLAIN", MatchAny) && ends_with(prev_wd, ')'))

I used:
else if (HeadMatches2("EXPLAIN", MatchAny) && ends_with(prev_wd, ')'))

> > I've done https://commitfest.postgresql.org/18/1661/
> 
> Thank you!

Thanks for your repeated reviews ; if this looks+works fine, please set to
R-F-C.

Actually..another thought: since toast tables may be VACUUM-ed, should I
introduce Query_for_list_of_tpmt ?

Update psql tab completion for commits:                                                                                                                                            
                                                                                                                                                                                   
Table completion for ANALYZE partitioned_table
3c3bb99330aa9b4c2f6258bfa0265d806bf365c3

Add parenthesized options syntax for ANALYZE.
854dd8cff523bc17972d34772b0e39ad3d6d46a4

Add VACUUM (DISABLE_PAGE_SKIPPING) for emergencies.
ede62e56fbe809baa1a7bc3873d82f12ffe7540b

Allow multiple tables to be specified in one VACUUM or ANALYZE command.
11d8d72c27a64ea4e30adce11cf6c4f3dd3e60db

Add hash partitioning.
1aba8e651ac3e37e1d2d875842de1e0ed22a651e

Parameter toast_tuple_target
c2513365a0a85e77d3c21adb92fe12cfbe0d1897

Parenthesized explain (...)
d4382c4ae7ea1e272f4fee388aac8ff99421471a

Parameter toast_tuple_target controls TOAST for new rows
c2513365a0a85e77d3c21adb92fe12cfbe0d1897

no longer accepts VACUUM ANALYZE VERBOSE
921059bd66c7fb1230c705d3b1a65940800c4cbb

Justin

Commits

  1. Improve tab completion for ANALYZE, EXPLAIN, and VACUUM.

  2. Minor fixes for psql tab completion.

  3. Add parenthesized options syntax for ANALYZE.

  4. Don't allow VACUUM VERBOSE ANALYZE VERBOSE.

  5. Parameter toast_tuple_target controls TOAST for new rows

  6. Add hash partitioning.

  7. Allow multiple tables to be specified in one VACUUM or ANALYZE command.

  8. Don't uselessly rewrite, truncate, VACUUM, or ANALYZE partitioned tables.

  9. Remove deprecated COMMENT ON RULE syntax

  10. Add VACUUM (DISABLE_PAGE_SKIPPING) for emergencies.

  11. Extend EXPLAIN to allow generic options to be specified.