Re: adding tab completions
Edmund Horner <ejrh00@gmail.com>
From: Edmund Horner <ejrh00@gmail.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2018-05-29T12:45:30Z
Lists: pgsql-hackers
On 29 May 2018 at 12:06, Justin Pryzby <pryzby@telsasoft.com> wrote:
> Find attached tab completion for the following:
>
> "... Also, recursively perform VACUUM and ANALYZE on partitions when the
> command is applied to a 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
Hi Justin,
I don't believe it's meaningful to match on words with spaces in them,
for instance, in
else if (Matches3("VACUUM", "FULL|FREEZE|FULL FREEZE", "ANALYZE")) {
as there will never be a word called "FULL FREEZE" (the tab completion
logic splits using spaces, though it will keep things in quotes and
parentheses together).
I don't know what the best approach is for cases like VACUUM, where
there are multiple optional words. Maybe something like the
following? It's pretty ugly, but then, it is part of the tab
completion logic; a good sense of compromise is needed there.
else if (Matches1("VACUUM"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tpmf,
" UNION SELECT 'FULL'"
" UNION SELECT 'FREEZE'"
" UNION SELECT 'VERBOSE'"
" UNION SELECT 'ANALYZE'"
" UNION SELECT '('");
else if (HeadMatches1("VACUUM") && TailMatches1("FULL"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tpmf,
" UNION SELECT 'FREEZE'"
" UNION SELECT 'VERBOSE'"
" UNION SELECT 'ANALYZE'");
else if (HeadMatches1("VACUUM") && TailMatches1("FREEZE"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tpmf,
" UNION SELECT 'VERBOSE'"
" UNION SELECT 'ANALYZE'");
else if (HeadMatches1("VACUUM") && TailMatches1("VERBOSE"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tpmf,
" UNION SELECT 'ANALYZE'");
(Not a patch file, so that you don't have to merge it with the rest of
your patch. ;-) )
Cheers,
Edmund
Commits
-
Improve tab completion for ANALYZE, EXPLAIN, and VACUUM.
- 121213d9d852 12.0 landed
-
Minor fixes for psql tab completion.
- 12368f5e83e7 11.0 landed
- 7046d3024605 12.0 landed
-
Add parenthesized options syntax for ANALYZE.
- 854dd8cff523 11.0 cited
-
Don't allow VACUUM VERBOSE ANALYZE VERBOSE.
- 921059bd66c7 11.0 cited
-
Parameter toast_tuple_target controls TOAST for new rows
- c2513365a0a8 11.0 cited
-
Add hash partitioning.
- 1aba8e651ac3 11.0 cited
-
Allow multiple tables to be specified in one VACUUM or ANALYZE command.
- 11d8d72c27a6 11.0 cited
-
Don't uselessly rewrite, truncate, VACUUM, or ANALYZE partitioned tables.
- 3c3bb99330aa 10.0 cited
-
Remove deprecated COMMENT ON RULE syntax
- e8d016d81940 10.0 cited
-
Add VACUUM (DISABLE_PAGE_SKIPPING) for emergencies.
- ede62e56fbe8 9.6.0 cited
-
Extend EXPLAIN to allow generic options to be specified.
- d4382c4ae7ea 9.0.0 cited