From 1146ea8fcdfdeccd27f1965f44dd2a220a068ccb Mon Sep 17 00:00:00 2001 From: wangw Date: Mon, 12 Apr 2021 08:59:12 +0800 Subject: [PATCH] An omission of automatic completion of CURRENT_ROLE in tab-complete.c --- src/bin/psql/tab-complete.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 3a43c09bf6..ab8404fce3 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -744,6 +744,7 @@ static const SchemaQuery Query_for_list_of_statistics = { " FROM pg_catalog.pg_roles "\ " WHERE substring(pg_catalog.quote_ident(rolname),1,%d)='%s'"\ " UNION ALL SELECT 'PUBLIC'"\ +" UNION ALL SELECT 'CURRENT_ROLE'"\ " UNION ALL SELECT 'CURRENT_USER'"\ " UNION ALL SELECT 'SESSION_USER'" @@ -3339,7 +3340,7 @@ psql_completion(const char *text, int start, int end) /* * Complete "GRANT/REVOKE ... TO/FROM" with username, PUBLIC, - * CURRENT_USER, or SESSION_USER. + * CURRENT_ROLE, CURRENT_USER, or SESSION_USER. */ else if ((HeadMatches("GRANT") && TailMatches("TO")) || (HeadMatches("REVOKE") && TailMatches("FROM"))) @@ -3758,6 +3759,7 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH("FOR"); else if (Matches("CREATE", "USER", "MAPPING", "FOR")) COMPLETE_WITH_QUERY(Query_for_list_of_roles + " UNION SELECT 'CURRENT_ROLE'" " UNION SELECT 'CURRENT_USER'" " UNION SELECT 'PUBLIC'" " UNION SELECT 'USER'"); -- 2.23.0.windows.1