tab completion for "create user mapping for"

Started by Jeff Janesover 8 years ago2 messages
#1Jeff Janes
jeff.janes@gmail.com
1 attachment(s)

If you have "CREATE USE" tab completion will recommend both USER and USER
MAPPING FOR.

But once you have the full "CREATE USER " or "CREATE USER M" it will not
complete the rest of the "MAPPING FOR".

Attached patch fixes that.

Cheers,

Jeff

Attachments:

user_mapping_tab_complete_v1.patchapplication/octet-stream; name=user_mapping_tab_complete_v1.patchDownload
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
new file mode 100644
index e9fdc90..e34922d
*** a/src/bin/psql/tab-complete.c
--- b/src/bin/psql/tab-complete.c
*************** static const pgsql_thing_t words_after_c
*** 1056,1062 ****
  															 * INDEX ... */
  	{"UNLOGGED", NULL, NULL, THING_NO_DROP | THING_NO_ALTER},	/* 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 */
--- 1056,1062 ----
  															 * INDEX ... */
  	{"UNLOGGED", NULL, NULL, THING_NO_DROP | THING_NO_ALTER},	/* for CREATE UNLOGGED
  																 * TABLE ... */
! 	{"USER", Query_for_list_of_roles " UNION SELECT 'MAPPING FOR'"},
  	{"USER MAPPING FOR", NULL, NULL},
  	{"VIEW", NULL, &Query_for_list_of_views},
  	{NULL}						/* end of list */
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jeff Janes (#1)
Re: tab completion for "create user mapping for"

Jeff Janes <jeff.janes@gmail.com> writes:

If you have "CREATE USE" tab completion will recommend both USER and USER
MAPPING FOR.

But once you have the full "CREATE USER " or "CREATE USER M" it will not
complete the rest of the "MAPPING FOR".

Attached patch fixes that.

Pushed, thanks.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers