Skip to content

Commit 084e385

Browse files
committed
Add tab completion for ALTER SYSTEM SET in psql.
1 parent f83a754 commit 084e385

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/bin/psql/tab-complete.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,12 @@ static const SchemaQuery Query_for_list_of_matviews = {
541541
"SELECT pg_catalog.quote_ident(nspname) FROM pg_catalog.pg_namespace "\
542542
" WHERE substring(pg_catalog.quote_ident(nspname),1,%d)='%s'"
543543

544+
#define Query_for_list_of_alter_system_set_vars \
545+
"SELECT name FROM "\
546+
" (SELECT pg_catalog.lower(name) AS name FROM pg_catalog.pg_settings "\
547+
" WHERE context != 'internal') ss "\
548+
" WHERE substring(name,1,%d)='%s'"
549+
544550
#define Query_for_list_of_set_vars \
545551
"SELECT name FROM "\
546552
" (SELECT pg_catalog.lower(name) AS name FROM pg_catalog.pg_settings "\
@@ -930,7 +936,7 @@ psql_completion(char *text, int start, int end)
930936
{"AGGREGATE", "COLLATION", "CONVERSION", "DATABASE", "DEFAULT PRIVILEGES", "DOMAIN",
931937
"EXTENSION", "FOREIGN DATA WRAPPER", "FOREIGN TABLE", "FUNCTION",
932938
"GROUP", "INDEX", "LANGUAGE", "LARGE OBJECT", "MATERIALIZED VIEW", "OPERATOR",
933-
"ROLE", "RULE", "SCHEMA", "SERVER", "SEQUENCE", "TABLE",
939+
"ROLE", "RULE", "SCHEMA", "SERVER", "SEQUENCE", "SYSTEM SET", "TABLE",
934940
"TABLESPACE", "TEXT SEARCH", "TRIGGER", "TYPE",
935941
"USER", "USER MAPPING FOR", "VIEW", NULL};
936942

@@ -1263,6 +1269,11 @@ psql_completion(char *text, int start, int end)
12631269

12641270
COMPLETE_WITH_LIST(list_ALTER_SERVER);
12651271
}
1272+
/* ALTER SYSTEM SET <name> */
1273+
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
1274+
pg_strcasecmp(prev2_wd, "SYSTEM") == 0 &&
1275+
pg_strcasecmp(prev_wd, "SET") == 0)
1276+
COMPLETE_WITH_QUERY(Query_for_list_of_alter_system_set_vars);
12661277
/* ALTER VIEW <name> */
12671278
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
12681279
pg_strcasecmp(prev2_wd, "VIEW") == 0)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy