@@ -588,6 +588,11 @@ static const SchemaQuery Query_for_list_of_views = {
588
588
" FROM pg_catalog.pg_available_extensions "\
589
589
" WHERE substring(pg_catalog.quote_ident(name),1,%d)='%s' AND installed_version IS NULL"
590
590
591
+ #define Query_for_list_of_prepared_statements \
592
+ " SELECT pg_catalog.quote_ident(name) "\
593
+ " FROM pg_catalog.pg_prepared_statements "\
594
+ " WHERE substring(pg_catalog.quote_ident(name),1,%d)='%s'"
595
+
591
596
/*
592
597
* This is a list of all "things" in Pgsql, which can show up after CREATE or
593
598
* DROP; and there is also a query to get a list of them.
@@ -1908,7 +1913,8 @@ psql_completion(char *text, int start, int end)
1908
1913
pg_strcasecmp (prev_wd , "ON" ) == 0 )
1909
1914
COMPLETE_WITH_SCHEMA_QUERY (Query_for_list_of_views , NULL );
1910
1915
/* complete CREATE TRIGGER ... EXECUTE with PROCEDURE */
1911
- else if (pg_strcasecmp (prev_wd , "EXECUTE" ) == 0 )
1916
+ else if (pg_strcasecmp (prev_wd , "EXECUTE" ) == 0 &&
1917
+ prev2_wd [0 ] != '\0' )
1912
1918
COMPLETE_WITH_CONST ("PROCEDURE" );
1913
1919
1914
1920
/* CREATE ROLE,USER,GROUP */
@@ -2117,6 +2123,11 @@ psql_completion(char *text, int start, int end)
2117
2123
COMPLETE_WITH_LIST (list_ALTERTEXTSEARCH );
2118
2124
}
2119
2125
2126
+ /* EXECUTE, but not EXECUTE embedded in other commands */
2127
+ else if (pg_strcasecmp (prev_wd , "EXECUTE" ) == 0 &&
2128
+ prev2_wd [0 ] == '\0' )
2129
+ COMPLETE_WITH_QUERY (Query_for_list_of_prepared_statements );
2130
+
2120
2131
/* EXPLAIN */
2121
2132
2122
2133
/*
0 commit comments