@@ -729,6 +729,13 @@ static const SchemaQuery Query_for_list_of_matviews = {
729
729
" FROM pg_catalog.pg_available_extensions "\
730
730
" WHERE substring(pg_catalog.quote_ident(name),1,%d)='%s' AND installed_version IS NULL"
731
731
732
+ /* the silly-looking length condition is just to eat up the current word */
733
+ #define Query_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
+
732
739
#define Query_for_list_of_prepared_statements \
733
740
" SELECT pg_catalog.quote_ident(name) "\
734
741
" FROM pg_catalog.pg_prepared_statements "\
@@ -2266,10 +2273,18 @@ psql_completion(const char *text, int start, int end)
2266
2273
pg_strcasecmp (prev2_wd , "EXTENSION" ) == 0 )
2267
2274
{
2268
2275
static const char * const list_CREATE_EXTENSION [] =
2269
- {"WITH SCHEMA" , "CASCADE" , NULL };
2276
+ {"WITH SCHEMA" , "CASCADE" , "VERSION" , NULL };
2270
2277
2271
2278
COMPLETE_WITH_LIST (list_CREATE_EXTENSION );
2272
2279
}
2280
+ /* CREATE EXTENSION <name> VERSION */
2281
+ else if (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
+ }
2273
2288
2274
2289
/* CREATE FOREIGN */
2275
2290
else if (pg_strcasecmp (prev2_wd , "CREATE" ) == 0 &&
0 commit comments