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

Commit8140c1b

Browse files
committed
Make psql support tab completion of EXECUTE <prepared-statement-name>.
Andreas Karlsson, reviewed by Josh Kupershmidt
1 parent7299778 commit8140c1b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,11 @@ static const SchemaQuery Query_for_list_of_views = {
588588
" FROM pg_catalog.pg_available_extensions "\
589589
" WHERE substring(pg_catalog.quote_ident(name),1,%d)='%s' AND installed_version IS NULL"
590590

591+
#defineQuery_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+
591596
/*
592597
* This is a list of all "things" in Pgsql, which can show up after CREATE or
593598
* 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)
19081913
pg_strcasecmp(prev_wd,"ON")==0)
19091914
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_views,NULL);
19101915
/* complete CREATE TRIGGER ... EXECUTE with PROCEDURE */
1911-
elseif (pg_strcasecmp(prev_wd,"EXECUTE")==0)
1916+
elseif (pg_strcasecmp(prev_wd,"EXECUTE")==0&&
1917+
prev2_wd[0]!='\0')
19121918
COMPLETE_WITH_CONST("PROCEDURE");
19131919

19141920
/* CREATE ROLE,USER,GROUP */
@@ -2117,6 +2123,11 @@ psql_completion(char *text, int start, int end)
21172123
COMPLETE_WITH_LIST(list_ALTERTEXTSEARCH);
21182124
}
21192125

2126+
/* EXECUTE, but not EXECUTE embedded in other commands */
2127+
elseif (pg_strcasecmp(prev_wd,"EXECUTE")==0&&
2128+
prev2_wd[0]=='\0')
2129+
COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements);
2130+
21202131
/* EXPLAIN */
21212132

21222133
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp