An omission of automatic completion in tab-complete.c
There is an omission of automatic completion of CURRENT_ROLE in tab-complete.c.
Best wishes,
Wei Wang
Attachments:
An-omission-of-automatic-completion-of-CURRENT_ROLE.patchapplication/octet-stream; name=An-omission-of-automatic-completion-of-CURRENT_ROLE.patchDownload
From 1146ea8fcdfdeccd27f1965f44dd2a220a068ccb Mon Sep 17 00:00:00 2001
From: wangw <wangw.fnst@fujitsu.com>
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
On Tue, Apr 20, 2021 at 03:28:38AM +0000, wangw.fnst@fujitsu.com wrote:
There is an omission of automatic completion of CURRENT_ROLE in tab-complete.c.
Indeed, that looks like an omission from 45b9805.
--
Michael
There is an omission of automatic completion of CURRENT_ROLE in tab-complete.c.
I invested some time in checking this patch. It passes make
check-world / make installcheck-world and adds CURRENT_ROLE to the
automatic completion.
--
Best regards,
Aleksander Alekseev
On Tue, Apr 20, 2021 at 11:35:13AM +0300, Aleksander Alekseev wrote:
I invested some time in checking this patch. It passes make
check-world / make installcheck-world and adds CURRENT_ROLE to the
automatic completion.
Thanks Aleksander and Wei. Applied.
--
Michael