Hi,

Attached patch implements the tab-completion for CREATE USER MAPPING command.
Comments?

Regards,

-- 
Fujii Masao
*** a/src/bin/psql/tab-complete.c
--- b/src/bin/psql/tab-complete.c
***************
*** 656,661 **** static const SchemaQuery Query_for_list_of_matviews = {
--- 656,667 ----
  "   FROM pg_catalog.pg_roles "\
  "  WHERE substring(pg_catalog.quote_ident(rolname),1,%d)='%s'"
  
+ #define Query_for_list_of_users \
+ " SELECT pg_catalog.quote_ident(rolname) "\
+ "   FROM pg_catalog.pg_roles "\
+ "  WHERE substring(pg_catalog.quote_ident(rolname),1,%d)='%s'"\
+ "  UNION ALL SELECT 'mapping'"
+ 
  #define Query_for_list_of_grant_roles \
  " SELECT pg_catalog.quote_ident(rolname) "\
  "   FROM pg_catalog.pg_roles "\
***************
*** 920,926 **** static const pgsql_thing_t words_after_create[] = {
  	{"UNIQUE", NULL, NULL, THING_NO_DROP},		/* for CREATE UNIQUE INDEX ... */
  	{"UNLOGGED", NULL, NULL, THING_NO_DROP},	/* for CREATE UNLOGGED TABLE
  												 * ... */
! 	{"USER", Query_for_list_of_roles},
  	{"USER MAPPING FOR", NULL, NULL},
  	{"VIEW", NULL, &Query_for_list_of_views},
  	{NULL}						/* end of list */
--- 926,932 ----
  	{"UNIQUE", NULL, NULL, THING_NO_DROP},		/* for CREATE UNIQUE INDEX ... */
  	{"UNLOGGED", NULL, NULL, THING_NO_DROP},	/* for CREATE UNLOGGED TABLE
  												 * ... */
! 	{"USER", Query_for_list_of_users},
  	{"USER MAPPING FOR", NULL, NULL},
  	{"VIEW", NULL, &Query_for_list_of_views},
  	{NULL}						/* end of list */
-- 
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