On Tue, Jul 7, 2015 at 2:11 AM, David Christensen <da...@endpoint.com> wrote:
> Quickie patch for spotted missing psql \ddp tab-completion.

Thanks for the report and patch!

I found that tab-completion was not supported in not only \ddp
but also other psql meta commands like \dE, \dm, \dO, \dy, \s and
\setenv. Attached patch adds all those missing tab-completions.

Thought?

Regards,

-- 
Fujii Masao
*** a/src/bin/psql/tab-complete.c
--- b/src/bin/psql/tab-complete.c
***************
*** 897,910 **** psql_completion(const char *text, int start, int end)
  
  	static const char *const backslash_commands[] = {
  		"\\a", "\\connect", "\\conninfo", "\\C", "\\cd", "\\copy", "\\copyright",
! 		"\\d", "\\da", "\\db", "\\dc", "\\dC", "\\dd", "\\dD", "\\des", "\\det", "\\deu", "\\dew", "\\df",
  		"\\dF", "\\dFd", "\\dFp", "\\dFt", "\\dg", "\\di", "\\dl", "\\dL",
! 		"\\dn", "\\do", "\\dp", "\\drds", "\\ds", "\\dS", "\\dt", "\\dT", "\\dv", "\\du", "\\dx",
  		"\\e", "\\echo", "\\ef", "\\encoding", "\\ev",
  		"\\f", "\\g", "\\gset", "\\h", "\\help", "\\H", "\\i", "\\ir", "\\l",
  		"\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
  		"\\o", "\\p", "\\password", "\\prompt", "\\pset", "\\q", "\\qecho", "\\r",
! 		"\\set", "\\sf", "\\sv", "\\t", "\\T",
  		"\\timing", "\\unset", "\\x", "\\w", "\\watch", "\\z", "\\!", NULL
  	};
  
--- 897,912 ----
  
  	static const char *const backslash_commands[] = {
  		"\\a", "\\connect", "\\conninfo", "\\C", "\\cd", "\\copy", "\\copyright",
! 		"\\d", "\\da", "\\db", "\\dc", "\\dC", "\\dd", "\\ddp", "\\dD",
! 		"\\des", "\\det", "\\deu", "\\dew", "\\dE", "\\df",
  		"\\dF", "\\dFd", "\\dFp", "\\dFt", "\\dg", "\\di", "\\dl", "\\dL",
! 		"\\dm", "\\dn", "\\do", "\\dO", "\\dp", "\\drds", "\\ds", "\\dS",
! 		"\\dt", "\\dT", "\\dv", "\\du", "\\dx", "\\dy",
  		"\\e", "\\echo", "\\ef", "\\encoding", "\\ev",
  		"\\f", "\\g", "\\gset", "\\h", "\\help", "\\H", "\\i", "\\ir", "\\l",
  		"\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
  		"\\o", "\\p", "\\password", "\\prompt", "\\pset", "\\q", "\\qecho", "\\r",
! 		"\\s", "\\set", "\\setenv", "\\sf", "\\sv", "\\t", "\\T",
  		"\\timing", "\\unset", "\\x", "\\w", "\\watch", "\\z", "\\!", NULL
  	};
  
***************
*** 3791,3796 **** psql_completion(const char *text, int start, int end)
--- 3793,3802 ----
  		COMPLETE_WITH_QUERY(Query_for_list_of_extensions);
  	else if (strncmp(prev_wd, "\\dm", strlen("\\dm")) == 0)
  		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews, NULL);
+ 	else if (strncmp(prev_wd, "\\dE", strlen("\\dE")) == 0)
+ 		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_foreign_tables, NULL);
+ 	else if (strncmp(prev_wd, "\\dy", strlen("\\dy")) == 0)
+ 		COMPLETE_WITH_QUERY(Query_for_list_of_event_triggers);
  
  	/* must be at end of \d list */
  	else if (strncmp(prev_wd, "\\d", strlen("\\d")) == 0)
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to