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

Commit7c0b49c

Browse files
committed
Tab complete CREATE EXTENSION .. VERSION.
Jeff Janes
1 parent84ef9c5 commit7c0b49c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,13 @@ static const SchemaQuery Query_for_list_of_matviews = {
729729
" FROM pg_catalog.pg_available_extensions "\
730730
" WHERE substring(pg_catalog.quote_ident(name),1,%d)='%s' AND installed_version IS NULL"
731731

732+
/* the silly-looking length condition is just to eat up the current word */
733+
#defineQuery_for_list_of_available_extension_versions \
734+
" SELECT pg_catalog.quote_ident(version) "\
735+
" FROM pg_catalog.pg_available_extension_versions "\
736+
" WHERE (%d = pg_catalog.length('%s'))"\
737+
" AND pg_catalog.quote_ident(name)='%s'"
738+
732739
#defineQuery_for_list_of_prepared_statements \
733740
" SELECT pg_catalog.quote_ident(name) "\
734741
" FROM pg_catalog.pg_prepared_statements "\
@@ -2266,10 +2273,18 @@ psql_completion(const char *text, int start, int end)
22662273
pg_strcasecmp(prev2_wd,"EXTENSION")==0)
22672274
{
22682275
staticconstchar*constlist_CREATE_EXTENSION[]=
2269-
{"WITH SCHEMA","CASCADE",NULL};
2276+
{"WITH SCHEMA","CASCADE","VERSION",NULL};
22702277

22712278
COMPLETE_WITH_LIST(list_CREATE_EXTENSION);
22722279
}
2280+
/* CREATE EXTENSION <name> VERSION */
2281+
elseif (pg_strcasecmp(prev4_wd,"CREATE")==0&&
2282+
pg_strcasecmp(prev3_wd,"EXTENSION")==0&&
2283+
pg_strcasecmp(prev_wd,"VERSION")==0)
2284+
{
2285+
completion_info_charp=prev2_wd;
2286+
COMPLETE_WITH_QUERY(Query_for_list_of_available_extension_versions);
2287+
}
22732288

22742289
/* CREATE FOREIGN */
22752290
elseif (pg_strcasecmp(prev2_wd,"CREATE")==0&&

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp