mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	psql tab-complete for CREATE/DROP ACCESS METHOD
Alexander Korotkov
This commit is contained in:
		@@ -877,6 +877,7 @@ typedef struct
 | 
			
		||||
#define THING_NO_SHOW		(THING_NO_CREATE | THING_NO_DROP)
 | 
			
		||||
 | 
			
		||||
static const pgsql_thing_t words_after_create[] = {
 | 
			
		||||
	{"ACCESS METHOD", NULL, NULL},
 | 
			
		||||
	{"AGGREGATE", NULL, &Query_for_list_of_aggregates},
 | 
			
		||||
	{"CAST", NULL, NULL},		/* Casts have complex structures for names, so
 | 
			
		||||
								 * skip it */
 | 
			
		||||
@@ -1977,6 +1978,17 @@ psql_completion(const char *text, int start, int end)
 | 
			
		||||
		COMPLETE_WITH_LIST5("HEADER", "QUOTE", "ESCAPE", "FORCE QUOTE",
 | 
			
		||||
							"FORCE NOT NULL");
 | 
			
		||||
 | 
			
		||||
	/* CREATE ACCESS METHOD */
 | 
			
		||||
	/* Complete "CREATE ACCESS METHOD <name>" */
 | 
			
		||||
	else if (Matches4("CREATE", "ACCESS", "METHOD", MatchAny))
 | 
			
		||||
		COMPLETE_WITH_CONST("TYPE");
 | 
			
		||||
	/* Complete "CREATE ACCESS METHOD <name> TYPE" */
 | 
			
		||||
	else if (Matches5("CREATE", "ACCESS", "METHOD", MatchAny, "TYPE"))
 | 
			
		||||
		COMPLETE_WITH_CONST("INDEX");
 | 
			
		||||
	/* Complete "CREATE ACCESS METHOD <name> TYPE <type>" */
 | 
			
		||||
	else if (Matches6("CREATE", "ACCESS", "METHOD", MatchAny, "TYPE", MatchAny))
 | 
			
		||||
		COMPLETE_WITH_CONST("HANDLER");
 | 
			
		||||
 | 
			
		||||
	/* CREATE DATABASE */
 | 
			
		||||
	else if (Matches3("CREATE", "DATABASE", MatchAny))
 | 
			
		||||
		COMPLETE_WITH_LIST9("OWNER", "TEMPLATE", "ENCODING", "TABLESPACE",
 | 
			
		||||
@@ -2263,6 +2275,7 @@ psql_completion(const char *text, int start, int end)
 | 
			
		||||
	else if (Matches3("DROP",
 | 
			
		||||
					  "COLLATION|CONVERSION|DOMAIN|EXTENSION|LANGUAGE|SCHEMA|SEQUENCE|SERVER|TABLE|TYPE|VIEW",
 | 
			
		||||
					  MatchAny) ||
 | 
			
		||||
			 Matches4("DROP", "ACCESS", "METHOD", MatchAny) ||
 | 
			
		||||
			 (Matches4("DROP", "AGGREGATE|FUNCTION", MatchAny, MatchAny) &&
 | 
			
		||||
			  ends_with(prev_wd, ')')) ||
 | 
			
		||||
			 Matches4("DROP", "EVENT", "TRIGGER", MatchAny) ||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user