On Sat, Jan 02, 2010 at 04:53:45PM -0500, Tom Lane wrote:
> David Fetter <[email protected]> writes:
> > On Sat, Jan 02, 2010 at 04:22:38PM -0500, Tom Lane wrote:
> >> (b) wrong in detail.
>
> > How?
>
> It doesn't actually work, because the query isn't paying attention to
> the current partial word. Try do language pl<tab>, or just compare
> source to the original Query_for_list_of_languages.
Thanks for the heads-up. New patch attached :)
Cheers,
David.
--
David Fetter <[email protected]> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: [email protected]
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
*** a/src/bin/psql/tab-complete.c
--- b/src/bin/psql/tab-complete.c
***************
*** 408,413 **** static const SchemaQuery Query_for_list_of_views = {
--- 408,420 ----
" WHERE lanname != 'internal' "\
" AND substring(pg_catalog.quote_ident(lanname),1,%d)='%s' "
+ #define Query_for_list_of_languages_inline \
+ "SELECT pg_catalog.quote_ident(lanname) "\
+ " FROM pg_language "\
+ " WHERE lanname != 'internal' "\
+ " AND laninline != 0"\
+ " AND substring(pg_catalog.quote_ident(lanname),1,%d)='%s' "
+
#define Query_for_list_of_schemas \
"SELECT pg_catalog.quote_ident(nspname) FROM pg_catalog.pg_namespace "\
" WHERE substring(pg_catalog.quote_ident(nspname),1,%d)='%s'"
***************
*** 618,624 **** psql_completion(char *text, int start, int end)
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE",
"CLUSTER",
"COMMENT", "COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE",
! "DELETE FROM", "DISCARD", "DROP", "END", "EXECUTE", "EXPLAIN",
"FETCH",
"GRANT", "INSERT", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY",
"PREPARE",
"REASSIGN", "REINDEX", "RELEASE", "RESET", "REVOKE", "ROLLBACK",
"SAVEPOINT", "SELECT", "SET", "SHOW", "START", "TABLE",
"TRUNCATE", "UNLISTEN",
--- 625,631 ----
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE",
"CLUSTER",
"COMMENT", "COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE",
! "DELETE FROM", "DISCARD", "DO", "DROP", "END", "EXECUTE",
"EXPLAIN", "FETCH",
"GRANT", "INSERT", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY",
"PREPARE",
"REASSIGN", "REINDEX", "RELEASE", "RESET", "REVOKE", "ROLLBACK",
"SAVEPOINT", "SELECT", "SET", "SHOW", "START", "TABLE",
"TRUNCATE", "UNLISTEN",
***************
*** 1543,1548 **** psql_completion(char *text, int start, int end)
--- 1550,1573 ----
COMPLETE_WITH_LIST(list_DISCARD);
}
+ /* DO */
+ /*
+ * Complete DO with LANGUAGE.
+ */
+ else if (pg_strcasecmp(prev_wd, "DO") == 0)
+ {
+ static const char *const list_DO[] =
+ {"LANGUAGE", NULL};
+
+ COMPLETE_WITH_LIST(list_DO);
+ }
+ /*
+ * Complete DO LANGUAGE with in-line-able languages.
+ */
+ else if (pg_strcasecmp(prev2_wd, "DO") == 0 &&
+ pg_strcasecmp(prev_wd, "LANGUAGE") == 0)
+ COMPLETE_WITH_QUERY(Query_for_list_of_languages_inline);
+
/* DROP (when not the previous word) */
/* DROP AGGREGATE */
else if (pg_strcasecmp(prev3_wd, "DROP") == 0 &&
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers