pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
An omission of automatic completion in tab-complete.c
4+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2021-04-21 22b2dec31b  Add CURRENT_ROLE to list of roles for tab completion of GRANT in psql
* An omission of automatic completion in tab-complete.c
@ 2021-04-20 03:28 wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
  2021-04-20 07:41 ` Re: An omission of automatic completion in tab-complete.c Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 4+ messages in thread

From: wangw.fnst@fujitsu.com @ 2021-04-20 03:28 UTC (permalink / raw)
  To: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>

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.patch (application/octet-stream, 1.5K) download 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
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: An omission of automatic completion in tab-complete.c
  2021-04-20 03:28 An omission of automatic completion in tab-complete.c wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
@ 2021-04-20 07:41 ` Michael Paquier <michael@paquier.xyz>
  2021-04-20 08:35   ` Re: An omission of automatic completion in tab-complete.c Aleksander Alekseev <aleksander@timescale.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Michael Paquier @ 2021-04-20 07:41 UTC (permalink / raw)
  To: wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; +Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>

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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: An omission of automatic completion in tab-complete.c
  2021-04-20 03:28 An omission of automatic completion in tab-complete.c wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
  2021-04-20 07:41 ` Re: An omission of automatic completion in tab-complete.c Michael Paquier <michael@paquier.xyz>
@ 2021-04-20 08:35   ` Aleksander Alekseev <aleksander@timescale.com>
  2021-04-21 01:49     ` Re: An omission of automatic completion in tab-complete.c Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 4+ messages in thread

From: Aleksander Alekseev @ 2021-04-20 08:35 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>

> 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





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: An omission of automatic completion in tab-complete.c
  2021-04-20 03:28 An omission of automatic completion in tab-complete.c wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
  2021-04-20 07:41 ` Re: An omission of automatic completion in tab-complete.c Michael Paquier <michael@paquier.xyz>
  2021-04-20 08:35   ` Re: An omission of automatic completion in tab-complete.c Aleksander Alekseev <aleksander@timescale.com>
@ 2021-04-21 01:49     ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2021-04-21 01:49 UTC (permalink / raw)
  To: Aleksander Alekseev <aleksander@timescale.com>; +Cc: wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>

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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2021-04-21 01:49 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 03:28 An omission of automatic completion in tab-complete.c wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
2021-04-20 07:41 ` Michael Paquier <michael@paquier.xyz>
2021-04-20 08:35   ` Aleksander Alekseev <aleksander@timescale.com>
2021-04-21 01:49     ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox