From: Fujii Masao Date: Thu, 19 Dec 2013 17:33:27 +0000 (+0900) Subject: Add tab completion for ALTER SYSTEM SET in psql. X-Git-Tag: REL9_4_BETA1~770 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=084e385a2fc0b596ff6aa0ede8d360a889a6c084;p=postgresql Add tab completion for ALTER SYSTEM SET in psql. --- diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 2a0bb71d64..6ee030860c 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -541,6 +541,12 @@ static const SchemaQuery Query_for_list_of_matviews = { "SELECT pg_catalog.quote_ident(nspname) FROM pg_catalog.pg_namespace "\ " WHERE substring(pg_catalog.quote_ident(nspname),1,%d)='%s'" +#define Query_for_list_of_alter_system_set_vars \ +"SELECT name FROM "\ +" (SELECT pg_catalog.lower(name) AS name FROM pg_catalog.pg_settings "\ +" WHERE context != 'internal') ss "\ +" WHERE substring(name,1,%d)='%s'" + #define Query_for_list_of_set_vars \ "SELECT name FROM "\ " (SELECT pg_catalog.lower(name) AS name FROM pg_catalog.pg_settings "\ @@ -930,7 +936,7 @@ psql_completion(char *text, int start, int end) {"AGGREGATE", "COLLATION", "CONVERSION", "DATABASE", "DEFAULT PRIVILEGES", "DOMAIN", "EXTENSION", "FOREIGN DATA WRAPPER", "FOREIGN TABLE", "FUNCTION", "GROUP", "INDEX", "LANGUAGE", "LARGE OBJECT", "MATERIALIZED VIEW", "OPERATOR", - "ROLE", "RULE", "SCHEMA", "SERVER", "SEQUENCE", "TABLE", + "ROLE", "RULE", "SCHEMA", "SERVER", "SEQUENCE", "SYSTEM SET", "TABLE", "TABLESPACE", "TEXT SEARCH", "TRIGGER", "TYPE", "USER", "USER MAPPING FOR", "VIEW", NULL}; @@ -1263,6 +1269,11 @@ psql_completion(char *text, int start, int end) COMPLETE_WITH_LIST(list_ALTER_SERVER); } + /* ALTER SYSTEM SET */ + else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 && + pg_strcasecmp(prev2_wd, "SYSTEM") == 0 && + pg_strcasecmp(prev_wd, "SET") == 0) + COMPLETE_WITH_QUERY(Query_for_list_of_alter_system_set_vars); /* ALTER VIEW */ else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 && pg_strcasecmp(prev2_wd, "VIEW") == 0)