Skip to content

Commit ff9bff0

Browse files
committed
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
1 parent e988878 commit ff9bff0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/bin/psql/tab-complete.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,15 +2065,21 @@ psql_completion(const char *text, int start, int end)
20652065
/*
20662066
* ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ]
20672067
* ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ]
2068-
*
2069-
* Currently the only allowed option is VERBOSE, so we can be skimpier on
2070-
* the option processing than VACUUM has to be.
20712068
*/
20722069
else if (Matches("ANALYZE"))
20732070
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_analyzables,
20742071
" UNION SELECT 'VERBOSE'");
2075-
else if (Matches("ANALYZE", "("))
2076-
COMPLETE_WITH("VERBOSE)");
2072+
else if (HeadMatches("ANALYZE", "(*") &&
2073+
!HeadMatches("ANALYZE", "(*)"))
2074+
{
2075+
/*
2076+
* This fires if we're in an unfinished parenthesized option list.
2077+
* get_previous_words treats a completed parenthesized option list as
2078+
* one word, so the above test is correct.
2079+
*/
2080+
if (ends_with(prev_wd, '(') || ends_with(prev_wd, ','))
2081+
COMPLETE_WITH("VERBOSE", "SKIP_LOCKED");
2082+
}
20772083
else if (HeadMatches("ANALYZE") && TailMatches("("))
20782084
/* "ANALYZE (" should be caught above, so assume we want columns */
20792085
COMPLETE_WITH_ATTR(prev2_wd, "");
@@ -3423,7 +3429,7 @@ psql_completion(const char *text, int start, int end)
34233429
*/
34243430
if (ends_with(prev_wd, '(') || ends_with(prev_wd, ','))
34253431
COMPLETE_WITH("FULL", "FREEZE", "ANALYZE", "VERBOSE",
3426-
"DISABLE_PAGE_SKIPPING");
3432+
"DISABLE_PAGE_SKIPPING", "SKIP_LOCKED");
34273433
}
34283434
else if (HeadMatches("VACUUM") && TailMatches("("))
34293435
/* "VACUUM (" should be caught above, so assume we want columns */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy