On 10/20/2011 09:53 PM, Tom Lane wrote:
With that change, the correct test at line 795 would become
else if (pg_strcasecmp(prev_wd, "DROP") == 0&&
prev2_wd[0] == '\0')
I've committed this --- please adjust the EXECUTE patch to match.
Thanks for cleaning up the code to some sanity, I should have done so
myself when I noticed the problem.
A new version is attached.
Best regards,
Andreas
--
Andreas Karlsson
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
new file mode 100644
index abf9bc7..ee63198
*** a/src/bin/psql/tab-complete.c
--- b/src/bin/psql/tab-complete.c
*************** static const SchemaQuery Query_for_list_
*** 588,593 ****
--- 588,598 ----
" FROM pg_catalog.pg_available_extensions "\
" WHERE substring(pg_catalog.quote_ident(name),1,%d)='%s' AND installed_version IS NULL"
+ #define Query_for_list_of_prepared_statements \
+ " SELECT pg_catalog.quote_ident(name) "\
+ " FROM pg_catalog.pg_prepared_statements "\
+ " WHERE substring(pg_catalog.quote_ident(name),1,%d)='%s'"
+
/*
* This is a list of all "things" in Pgsql, which can show up after CREATE or
* DROP; and there is also a query to get a list of them.
*************** psql_completion(char *text, int start, i
*** 1640,1645 ****
--- 1645,1656 ----
COMPLETE_WITH_LIST(list_CSV);
}
+ /* EXECUTE */
+ /* must not match CREATE TRIGGER ... EXECUTE PROCEDURE */
+ else if (pg_strcasecmp(prev_wd, "EXECUTE") == 0 &&
+ prev2_wd[0] == '\0')
+ COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements);
+
/* CREATE DATABASE */
else if (pg_strcasecmp(prev3_wd, "CREATE") == 0 &&
pg_strcasecmp(prev2_wd, "DATABASE") == 0)
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers