ALTER INDEX...SET tab completion

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

I can never remember the syntax for setting index storage parameters. Is
it =, TO, or just a space between the parameter name and the setting?

This makes the tab completion more helpful, by providing the (mandatory)
equals sign.

Cheers,

Jeff

Attachments:

alter_index_tabcomplete_v1.patchapplication/octet-stream; name=alter_index_tabcomplete_v1.patchDownload
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
new file mode 100644
index 0cb3464..8f14323
*** a/src/bin/psql/tab-complete.c
--- b/src/bin/psql/tab-complete.c
*************** psql_completion(const char *text, int st
*** 1209,1216 ****
  	/* ALTER INDEX <foo> SET|RESET ( */
  	else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 &&
  			 pg_strcasecmp(prev4_wd, "INDEX") == 0 &&
! 			 (pg_strcasecmp(prev2_wd, "SET") == 0 ||
! 			  pg_strcasecmp(prev2_wd, "RESET") == 0) &&
  			 pg_strcasecmp(prev_wd, "(") == 0)
  	{
  		static const char *const list_INDEXOPTIONS[] =
--- 1209,1215 ----
  	/* ALTER INDEX <foo> SET|RESET ( */
  	else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 &&
  			 pg_strcasecmp(prev4_wd, "INDEX") == 0 &&
! 			 pg_strcasecmp(prev2_wd, "RESET") == 0 &&
  			 pg_strcasecmp(prev_wd, "(") == 0)
  	{
  		static const char *const list_INDEXOPTIONS[] =
*************** psql_completion(const char *text, int st
*** 1218,1223 ****
--- 1217,1232 ----
  
  		COMPLETE_WITH_LIST(list_INDEXOPTIONS);
  	}
+ 	else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 &&
+ 			 pg_strcasecmp(prev4_wd, "INDEX") == 0 &&
+ 			 pg_strcasecmp(prev2_wd, "SET") == 0 &&
+ 			 pg_strcasecmp(prev_wd, "(") == 0)
+ 	{
+ 		static const char *const list_INDEXOPTIONS[] =
+ 		{"fillfactor =", "fastupdate =", "gin_pending_list_limit =", NULL};
+ 
+ 		COMPLETE_WITH_LIST(list_INDEXOPTIONS);
+ 	}
  
  	/* ALTER LANGUAGE <name> */
  	else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
#2Robert Haas
robertmhaas@gmail.com
In reply to: Jeff Janes (#1)
Re: ALTER INDEX...SET tab completion

On Tue, Sep 8, 2015 at 4:23 PM, Jeff Janes <jeff.janes@gmail.com> wrote:

I can never remember the syntax for setting index storage parameters. Is it
=, TO, or just a space between the parameter name and the setting?

This makes the tab completion more helpful, by providing the (mandatory)
equals sign.

Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

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