Skip to content

Commit c407d54

Browse files
committed
Add tab completion for ALTER USER/ROLE RESET
Currently tab completion for ALTER USER RESET shows a list of all configuration parameters that may be set on a role, irrespectively of which parameters are actually set. This patch improves tab completion to offer only parameters that are set. Author: Robins Tharakan Reviewed-By: Tomas Vondra Discussion: https://postgr.es/m/CAEP4nAzqiT6VbVC5r3nq5byLTnPzjniVGzEMpYcnAHQyNzEuaw%40mail.gmail.com
1 parent 9df8727 commit c407d54

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bin/psql/tab-complete.in.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,11 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
10771077
" FROM pg_catalog.pg_user_mappings "\
10781078
" WHERE usename LIKE '%s'"
10791079

1080+
#define Query_for_list_of_user_vars \
1081+
" SELECT pg_catalog.split_part(pg_catalog.unnest(rolconfig),'=',1) "\
1082+
" FROM pg_catalog.pg_roles "\
1083+
" WHERE rolname LIKE '%s'"
1084+
10801085
#define Query_for_list_of_access_methods \
10811086
" SELECT amname "\
10821087
" FROM pg_catalog.pg_am "\
@@ -2487,6 +2492,10 @@ match_previous_words(int pattern_id,
24872492
"RENAME TO", "REPLICATION", "RESET", "SET", "SUPERUSER",
24882493
"VALID UNTIL", "WITH");
24892494

2495+
/* ALTER USER,ROLE <name> RESET */
2496+
else if (Matches("ALTER", "USER|ROLE", MatchAny, "RESET"))
2497+
COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_user_vars, "ALL");
2498+
24902499
/* ALTER USER,ROLE <name> WITH */
24912500
else if (Matches("ALTER", "USER|ROLE", MatchAny, "WITH"))
24922501
/* Similar to the above, but don't complete "WITH" again. */

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