Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit49917db

Browse files
committed
Improve psql's tab completion for ALTER EXTENSION foo UPDATE ...
Offer a list of available versions for that extension. Formerly, sincethere was no special support for this, it triggered off the UPDATEkeyword and offered a list of table names --- not too helpful.Jeff Janes, reviewed by Gerdan SantosPatch: <CAMkU=1z0gxEOLg2BWa69P4X4Ot8xBxipGUiGkXe_tC+raj79-Q@mail.gmail.com>
1 parentf9d747a commit49917db

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎src/bin/psql/tab-complete.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,13 @@ static const SchemaQuery Query_for_list_of_matviews = {
820820
" WHERE (%d = pg_catalog.length('%s'))"\
821821
" AND pg_catalog.quote_ident(name)='%s'"
822822

823+
/* the silly-looking length condition is just to eat up the current word */
824+
#defineQuery_for_list_of_available_extension_versions_with_TO \
825+
" SELECT 'TO ' || pg_catalog.quote_ident(version) "\
826+
" FROM pg_catalog.pg_available_extension_versions "\
827+
" WHERE (%d = pg_catalog.length('%s'))"\
828+
" AND pg_catalog.quote_ident(name)='%s'"
829+
823830
#defineQuery_for_list_of_prepared_statements \
824831
" SELECT pg_catalog.quote_ident(name) "\
825832
" FROM pg_catalog.pg_prepared_statements "\
@@ -1414,6 +1421,20 @@ psql_completion(const char *text, int start, int end)
14141421
elseif (Matches3("ALTER","EXTENSION",MatchAny))
14151422
COMPLETE_WITH_LIST4("ADD","DROP","UPDATE","SET SCHEMA");
14161423

1424+
/* ALTER EXTENSION <name> UPDATE */
1425+
elseif (Matches4("ALTER","EXTENSION",MatchAny,"UPDATE"))
1426+
{
1427+
completion_info_charp=prev2_wd;
1428+
COMPLETE_WITH_QUERY(Query_for_list_of_available_extension_versions_with_TO);
1429+
}
1430+
1431+
/* ALTER EXTENSION <name> UPDATE TO */
1432+
elseif (Matches5("ALTER","EXTENSION",MatchAny,"UPDATE","TO"))
1433+
{
1434+
completion_info_charp=prev3_wd;
1435+
COMPLETE_WITH_QUERY(Query_for_list_of_available_extension_versions);
1436+
}
1437+
14171438
/* ALTER FOREIGN */
14181439
elseif (Matches2("ALTER","FOREIGN"))
14191440
COMPLETE_WITH_LIST2("DATA WRAPPER","TABLE");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp