mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-29 22:49:41 +03:00 
			
		
		
		
	Add tab-completion for psql meta-commands.
Based on the original code from David Christensen, modified by me.
This commit is contained in:
		| @@ -897,14 +897,16 @@ psql_completion(const char *text, int start, int end) | |||||||
|  |  | ||||||
| 	static const char *const backslash_commands[] = { | 	static const char *const backslash_commands[] = { | ||||||
| 		"\\a", "\\connect", "\\conninfo", "\\C", "\\cd", "\\copy", "\\copyright", | 		"\\a", "\\connect", "\\conninfo", "\\C", "\\cd", "\\copy", "\\copyright", | ||||||
| 		"\\d", "\\da", "\\db", "\\dc", "\\dC", "\\dd", "\\dD", "\\des", "\\det", "\\deu", "\\dew", "\\df", | 		"\\d", "\\da", "\\db", "\\dc", "\\dC", "\\dd", "\\ddp", "\\dD", | ||||||
|  | 		"\\des", "\\det", "\\deu", "\\dew", "\\dE", "\\df", | ||||||
| 		"\\dF", "\\dFd", "\\dFp", "\\dFt", "\\dg", "\\di", "\\dl", "\\dL", | 		"\\dF", "\\dFd", "\\dFp", "\\dFt", "\\dg", "\\di", "\\dl", "\\dL", | ||||||
| 		"\\dn", "\\do", "\\dp", "\\drds", "\\ds", "\\dS", "\\dt", "\\dT", "\\dv", "\\du", "\\dx", | 		"\\dm", "\\dn", "\\do", "\\dO", "\\dp", "\\drds", "\\ds", "\\dS", | ||||||
|  | 		"\\dt", "\\dT", "\\dv", "\\du", "\\dx", "\\dy", | ||||||
| 		"\\e", "\\echo", "\\ef", "\\encoding", | 		"\\e", "\\echo", "\\ef", "\\encoding", | ||||||
| 		"\\f", "\\g", "\\gset", "\\h", "\\help", "\\H", "\\i", "\\ir", "\\l", | 		"\\f", "\\g", "\\gset", "\\h", "\\help", "\\H", "\\i", "\\ir", "\\l", | ||||||
| 		"\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink", | 		"\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink", | ||||||
| 		"\\o", "\\p", "\\password", "\\prompt", "\\pset", "\\q", "\\qecho", "\\r", | 		"\\o", "\\p", "\\password", "\\prompt", "\\pset", "\\q", "\\qecho", "\\r", | ||||||
| 		"\\set", "\\sf", "\\t", "\\T", | 		"\\s", "\\set", "\\setenv", "\\sf", "\\t", "\\T", | ||||||
| 		"\\timing", "\\unset", "\\x", "\\w", "\\watch", "\\z", "\\!", NULL | 		"\\timing", "\\unset", "\\x", "\\w", "\\watch", "\\z", "\\!", NULL | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| @@ -3791,6 +3793,10 @@ psql_completion(const char *text, int start, int end) | |||||||
| 		COMPLETE_WITH_QUERY(Query_for_list_of_extensions); | 		COMPLETE_WITH_QUERY(Query_for_list_of_extensions); | ||||||
| 	else if (strncmp(prev_wd, "\\dm", strlen("\\dm")) == 0) | 	else if (strncmp(prev_wd, "\\dm", strlen("\\dm")) == 0) | ||||||
| 		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews, NULL); | 		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 */ | 	/* must be at end of \d list */ | ||||||
| 	else if (strncmp(prev_wd, "\\d", strlen("\\d")) == 0) | 	else if (strncmp(prev_wd, "\\d", strlen("\\d")) == 0) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user