Teach SKIP_LOCKED to psql tab completion of VACUUM and ANALYZE
This was missing since 803b130, which has introduced the option for the user-facing VACUUM and ANALYZE. Author: Masahiko Sawada Discussion: https://postgr.es/m/CAD21AoD2TMdTxRhZ7WSp940V82_OAyPmgHnbi25UbbArLgA92Q@mail.gmail.com
This commit is contained in:
parent
e988878f85
commit
ff9bff0a85
@ -2065,15 +2065,21 @@ psql_completion(const char *text, int start, int end)
|
|||||||
/*
|
/*
|
||||||
* ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
|
* ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
|
||||||
* ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]
|
* ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]
|
||||||
*
|
|
||||||
* Currently the only allowed option is VERBOSE, so we can be skimpier on
|
|
||||||
* the option processing than VACUUM has to be.
|
|
||||||
*/
|
*/
|
||||||
else if (Matches("ANALYZE"))
|
else if (Matches("ANALYZE"))
|
||||||
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_analyzables,
|
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_analyzables,
|
||||||
" UNION SELECT 'VERBOSE'");
|
" UNION SELECT 'VERBOSE'");
|
||||||
else if (Matches("ANALYZE", "("))
|
else if (HeadMatches("ANALYZE", "(*") &&
|
||||||
COMPLETE_WITH("VERBOSE)");
|
!HeadMatches("ANALYZE", "(*)"))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* This fires if we're in an unfinished parenthesized option list.
|
||||||
|
* get_previous_words treats a completed parenthesized option list as
|
||||||
|
* one word, so the above test is correct.
|
||||||
|
*/
|
||||||
|
if (ends_with(prev_wd, '(') || ends_with(prev_wd, ','))
|
||||||
|
COMPLETE_WITH("VERBOSE", "SKIP_LOCKED");
|
||||||
|
}
|
||||||
else if (HeadMatches("ANALYZE") && TailMatches("("))
|
else if (HeadMatches("ANALYZE") && TailMatches("("))
|
||||||
/* "ANALYZE (" should be caught above, so assume we want columns */
|
/* "ANALYZE (" should be caught above, so assume we want columns */
|
||||||
COMPLETE_WITH_ATTR(prev2_wd, "");
|
COMPLETE_WITH_ATTR(prev2_wd, "");
|
||||||
@ -3423,7 +3429,7 @@ psql_completion(const char *text, int start, int end)
|
|||||||
*/
|
*/
|
||||||
if (ends_with(prev_wd, '(') || ends_with(prev_wd, ','))
|
if (ends_with(prev_wd, '(') || ends_with(prev_wd, ','))
|
||||||
COMPLETE_WITH("FULL", "FREEZE", "ANALYZE", "VERBOSE",
|
COMPLETE_WITH("FULL", "FREEZE", "ANALYZE", "VERBOSE",
|
||||||
"DISABLE_PAGE_SKIPPING");
|
"DISABLE_PAGE_SKIPPING", "SKIP_LOCKED");
|
||||||
}
|
}
|
||||||
else if (HeadMatches("VACUUM") && TailMatches("("))
|
else if (HeadMatches("VACUUM") && TailMatches("("))
|
||||||
/* "VACUUM (" should be caught above, so assume we want columns */
|
/* "VACUUM (" should be caught above, so assume we want columns */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user