pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Tab completion for GRANT MAINTAIN
4+ messages / 4 participants
[nested] [flat]

Commits from this thread:
  2023-04-19 9e1e9d6560  Add missed case for tab completion of GRANT/REVOKE MAINTAIN.
* Tab completion for GRANT MAINTAIN
@ 2023-04-18 09:08  Ken Kato <katouknl@oss.nttdata.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Ken Kato @ 2023-04-18 09:08 UTC (permalink / raw)
  To: pgsql-hackers@lists.postgresql.org

Hi hackers,

I found that GRANT MAINTAIN is not tab-completed with ON, so here is a 
patch.

Best wishes,

-- 
Ken Kato
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachments:

grant_maintain_tab_completion_v1.patch (text/x-diff, 728B) download diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 5825b2a195..bd04244969 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3902,7 +3902,7 @@ psql_completion(const char *text, int start, int end) else if (TailMatches("GRANT|REVOKE", MatchAny) || TailMatches("REVOKE", "GRANT", "OPTION", "FOR", MatchAny)) { - if (TailMatches("SELECT|INSERT|UPDATE|DELETE|TRUNCATE|REFERENCES|TRIGGER|CREATE|CONNECT|TEMPORARY|TEMP|EXECUTE|USAGE|ALL")) + if (TailMatches("SELECT|INSERT|UPDATE|DELETE|TRUNCATE|REFERENCES|TRIGGER|CREATE|CONNECT|TEMPORARY|TEMP|EXECUTE|USAGE|MAINTAIN|ALL")) COMPLETE_WITH("ON"); else if (TailMatches("GRANT", MatchAny)) COMPLETE_WITH("TO");
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: Tab completion for GRANT MAINTAIN
@ 2023-04-19 11:50  Jim Jones <jim.jones@uni-muenster.de>
  parent: Ken Kato <katouknl@oss.nttdata.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Jim Jones @ 2023-04-19 11:50 UTC (permalink / raw)
  To: Ken Kato <katouknl@oss.nttdata.com>; pgsql-hackers@lists.postgresql.org

On 18.04.23 11:08, Ken Kato wrote:
> Hi hackers,
>
> I found that GRANT MAINTAIN is not tab-completed with ON, so here is a 
> patch.

Hi,

the patch applies cleanly and now GRANT MAINTAIN tab-completes with ON. 
For the sake of completeness I tested a whole statement:

postgres=# GRANT M<tab>

=> postgres=# GRANT MAINTAIN

postgres=# GRANT MAINTAIN <tab>

=> postgres=# GRANT MAINTAIN ON

postgres=# GRANT MAINTAIN ON t <tab>

=> postgres=# GRANT MAINTAIN ON t TO

postgres=# GRANT MAINTAIN ON t TO <tab><tab>

=>

CURRENT_ROLE pg_monitor                   pg_use_reserved_connections
CURRENT_USER                 pg_read_all_data pg_write_all_data
pg_checkpoint                pg_read_all_settings pg_write_server_files
pg_create_subscription       pg_read_all_stats postgres
pg_database_owner            pg_read_server_files         PUBLIC
pg_execute_server_program    pg_signal_backend SESSION_USER
pg_maintain                  pg_stat_scan_tables

I've marked the CF entry as "ready for committer"

Best, Jim






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

* Re: Tab completion for GRANT MAINTAIN
@ 2023-04-19 14:54  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jim Jones <jim.jones@uni-muenster.de>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2023-04-19 14:54 UTC (permalink / raw)
  To: Jim Jones <jim.jones@uni-muenster.de>; +Cc: Ken Kato <katouknl@oss.nttdata.com>; pgsql-hackers@lists.postgresql.org

Jim Jones <jim.jones@uni-muenster.de> writes:
> On 18.04.23 11:08, Ken Kato wrote:
>> I found that GRANT MAINTAIN is not tab-completed with ON, so here is a 
>> patch.

> I've marked the CF entry as "ready for committer"

Yup, clearly an oversight.  Pushed.

(One could wish that it didn't take touching three or so places in
tab-complete.c to add a privilege, especially when a naive hacker might
think he was done after touching Privilege_options_of_grant_and_revoke.
I didn't see any easy way to improve that situation though.)

			regards, tom lane





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

* Re: Tab completion for GRANT MAINTAIN
@ 2023-04-20 20:17  Nathan Bossart <nathandbossart@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Nathan Bossart @ 2023-04-20 20:17 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jim Jones <jim.jones@uni-muenster.de>; Ken Kato <katouknl@oss.nttdata.com>; pgsql-hackers@lists.postgresql.org

On Wed, Apr 19, 2023 at 10:54:05AM -0400, Tom Lane wrote:
> (One could wish that it didn't take touching three or so places in
> tab-complete.c to add a privilege, especially when a naive hacker might
> think he was done after touching Privilege_options_of_grant_and_revoke.
> I didn't see any easy way to improve that situation though.)

Sorry, I think this was my fault.  Thanks for fixing.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com





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


end of thread, other threads:[~2023-04-20 20:17 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 09:08 Tab completion for GRANT MAINTAIN Ken Kato <katouknl@oss.nttdata.com>
2023-04-19 11:50 ` Jim Jones <jim.jones@uni-muenster.de>
2023-04-19 14:54   ` Tom Lane <tgl@sss.pgh.pa.us>
2023-04-20 20:17     ` Nathan Bossart <nathandbossart@gmail.com>

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