Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 22b2dec

Browse filesBrowse files
committed
Add CURRENT_ROLE to list of roles for tab completion of GRANT in psql
This compatibility has been added in 45b9805, but psql forgot the call. Author: Wei Wang Reviewed-by: Aleksander Alekseev Discussion: https://postgr.es/m/OS3PR01MB6275935F62E161BCD393D6559E489@OS3PR01MB6275.jpnprd01.prod.outlook.com
1 parent 783be78 commit 22b2dec
Copy full SHA for 22b2dec

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/bin/psql/tab-complete.c
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ static const SchemaQuery Query_for_list_of_collations = {
764764
" FROM pg_catalog.pg_roles "\
765765
" WHERE substring(pg_catalog.quote_ident(rolname),1,%d)='%s'"\
766766
" UNION ALL SELECT 'PUBLIC'"\
767+
" UNION ALL SELECT 'CURRENT_ROLE'"\
767768
" UNION ALL SELECT 'CURRENT_USER'"\
768769
" UNION ALL SELECT 'SESSION_USER'"
769770

@@ -3450,7 +3451,7 @@ psql_completion(const char *text, int start, int end)
34503451

34513452
/*
34523453
* Complete "GRANT/REVOKE ... TO/FROM" with username, PUBLIC,
3453-
* CURRENT_USER, or SESSION_USER.
3454+
* CURRENT_ROLE, CURRENT_USER, or SESSION_USER.
34543455
*/
34553456
else if ((HeadMatches("GRANT") && TailMatches("TO")) ||
34563457
(HeadMatches("REVOKE") && TailMatches("FROM")))
@@ -3884,6 +3885,7 @@ psql_completion(const char *text, int start, int end)
38843885
COMPLETE_WITH("FOR");
38853886
else if (Matches("CREATE", "USER", "MAPPING", "FOR"))
38863887
COMPLETE_WITH_QUERY(Query_for_list_of_roles
3888+
" UNION SELECT 'CURRENT_ROLE'"
38873889
" UNION SELECT 'CURRENT_USER'"
38883890
" UNION SELECT 'PUBLIC'"
38893891
" UNION SELECT 'USER'");

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.