Re: adding tab completions

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Arthur Zakirov <a.zakirov@postgrespro.ru>, Edmund Horner <ejrh00@gmail.com>, Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2018-06-03T23:18:59Z
Lists: pgsql-hackers

Attachments

I finally got back to this; thanks everyone for reviews;

I also added completion for parenthesized explain (...)
d4382c4ae7ea1e272f4fee388aac8ff99421471a

and for ALTER TABLE SET (toast_tuple_target).
c2513365a0a85e77d3c21adb92fe12cfbe0d1897

BTW..should that be toast.tuple_target ??

Note that this also tries to comply with 921059bd66c7fb1230c705d3b1a65940800c4cbb
This is okay in v10 but rejected in v11b1:
	postgres=# VACUUM ANALYZE VERBOSE t;
	ERROR:  syntax error at or near "VERBOSE"

On Tue, May 29, 2018 at 10:12:27AM -0400, Alvaro Herrera wrote:
> Is it just me that finds shocking the notion of vacuuming a foreign
> table?

Fixed, thanks.

On Tue, May 29, 2018 at 12:27:27PM +0300, Arthur Zakirov wrote:
> The patch replaces the variable Query_for_list_of_tmf by
> Query_for_list_of_tpmf. So I think Query_for_list_of_tmf isn't needed
> anymore and can be removed.

Fixed by adding relkind='p' to the existing list rather than making a new
query entry.

> Also I think it could be good to list column names after parentheses,
> but I'm not sure if it easy to implement.

I tried this and nearly gave up, but see attached.

The complication is that table names for which to pull the attributes isn't at a
constant offset; for example:
vacuum analyze a(TAB => needs prev2_wd
but
vacuum analyze a(c, TAB => needs prev3_wd

Maybe that's too much effort to include in tab completion.  If so, the
"prev_parens" stanza can be removed from VACUUM and ANALYZE.  If it's desired
to keep it, I guess I should avoid the duplicated lines.

On Wed, May 30, 2018 at 12:45:30AM +1200, Edmund Horner wrote:
> I don't believe it's meaningful to match on words with spaces in them,

Excellent point...fixed.

Find attached v6 (there were some "unpublished" versions).

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.