mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
psql: Add tab completion for VACUUM and ANALYZE ... ONLY option.
Improve psql's tab completion for VACUUM and ANALYZE by supporting
the ONLY option introduced in 62ddf7ee9
.
In passing, simplify some of the VACUUM patterns by making use
of MatchAnyN.
Author: Umar Hayat <postgresql.wizard@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
Discussion: https://postgr.es/m/CAD68Dp3L6yW_nWs+MWBs6s8tKLRzXaQdQgVRm4byZe0L-hRD8g@mail.gmail.com
This commit is contained in:
@ -3069,12 +3069,15 @@ match_previous_words(int pattern_id,
|
|||||||
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
|
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
|
* ANALYZE [ ( option [, ...] ) ] [ [ ONLY ] table_and_columns [, ...] ]
|
||||||
* ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]
|
* ANALYZE [ VERBOSE ] [ [ ONLY ] table_and_columns [, ...] ]
|
||||||
*/
|
*/
|
||||||
else if (Matches("ANALYZE"))
|
else if (Matches("ANALYZE"))
|
||||||
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_analyzables,
|
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_analyzables,
|
||||||
"VERBOSE");
|
"(", "VERBOSE", "ONLY");
|
||||||
|
else if (Matches("ANALYZE", "VERBOSE"))
|
||||||
|
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_analyzables,
|
||||||
|
"ONLY");
|
||||||
else if (HeadMatches("ANALYZE", "(*") &&
|
else if (HeadMatches("ANALYZE", "(*") &&
|
||||||
!HeadMatches("ANALYZE", "(*)"))
|
!HeadMatches("ANALYZE", "(*)"))
|
||||||
{
|
{
|
||||||
@ -5128,30 +5131,35 @@ match_previous_words(int pattern_id,
|
|||||||
COMPLETE_WITH("OPTIONS");
|
COMPLETE_WITH("OPTIONS");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VACUUM [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
|
* VACUUM [ ( option [, ...] ) ] [ [ ONLY ] table_and_columns [, ...] ]
|
||||||
* VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ table_and_columns [, ...] ]
|
* VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ [ ONLY ] table_and_columns [, ...] ]
|
||||||
*/
|
*/
|
||||||
else if (Matches("VACUUM"))
|
else if (Matches("VACUUM"))
|
||||||
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_vacuumables,
|
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_vacuumables,
|
||||||
|
"(",
|
||||||
"FULL",
|
"FULL",
|
||||||
"FREEZE",
|
"FREEZE",
|
||||||
|
"VERBOSE",
|
||||||
"ANALYZE",
|
"ANALYZE",
|
||||||
"VERBOSE");
|
"ONLY");
|
||||||
else if (Matches("VACUUM", "FULL"))
|
else if (Matches("VACUUM", "FULL"))
|
||||||
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_vacuumables,
|
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_vacuumables,
|
||||||
"FREEZE",
|
"FREEZE",
|
||||||
|
"VERBOSE",
|
||||||
"ANALYZE",
|
"ANALYZE",
|
||||||
"VERBOSE");
|
"ONLY");
|
||||||
else if (Matches("VACUUM", "FREEZE") ||
|
else if (Matches("VACUUM", MatchAnyN, "FREEZE"))
|
||||||
Matches("VACUUM", "FULL", "FREEZE"))
|
|
||||||
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_vacuumables,
|
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_vacuumables,
|
||||||
"VERBOSE",
|
"VERBOSE",
|
||||||
"ANALYZE");
|
"ANALYZE",
|
||||||
else if (Matches("VACUUM", "VERBOSE") ||
|
"ONLY");
|
||||||
Matches("VACUUM", "FULL|FREEZE", "VERBOSE") ||
|
else if (Matches("VACUUM", MatchAnyN, "VERBOSE"))
|
||||||
Matches("VACUUM", "FULL", "FREEZE", "VERBOSE"))
|
|
||||||
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_vacuumables,
|
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_vacuumables,
|
||||||
"ANALYZE");
|
"ANALYZE",
|
||||||
|
"ONLY");
|
||||||
|
else if (Matches("VACUUM", MatchAnyN, "ANALYZE"))
|
||||||
|
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_vacuumables,
|
||||||
|
"ONLY");
|
||||||
else if (HeadMatches("VACUUM", "(*") &&
|
else if (HeadMatches("VACUUM", "(*") &&
|
||||||
!HeadMatches("VACUUM", "(*)"))
|
!HeadMatches("VACUUM", "(*)"))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user