mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Add support for GRANT SET in psql tab completion
3d14e17
has added support for this query but psql was not able to
complete it. Spotted while working on a different patch in the same
area.
Reviewed-by: Robert Haas
Discussion: https://postgr.es/m/Y3hw7yvG0VwpC1jq@paquier.xyz
This commit is contained in:
parent
eae7fe4859
commit
9d0cf57492
@ -3773,7 +3773,7 @@ psql_completion(const char *text, int start, int end)
|
||||
*/
|
||||
/* Complete GRANT/REVOKE with a list of roles and privileges */
|
||||
else if (TailMatches("GRANT|REVOKE") ||
|
||||
TailMatches("REVOKE", "ADMIN|GRANT|INHERIT", "OPTION", "FOR"))
|
||||
TailMatches("REVOKE", "ADMIN|GRANT|INHERIT|SET", "OPTION", "FOR"))
|
||||
{
|
||||
/*
|
||||
* With ALTER DEFAULT PRIVILEGES, restrict completion to grantable
|
||||
@ -3792,10 +3792,11 @@ psql_completion(const char *text, int start, int end)
|
||||
Privilege_options_of_grant_and_revoke,
|
||||
"GRANT OPTION FOR",
|
||||
"ADMIN OPTION FOR",
|
||||
"INHERIT OPTION FOR");
|
||||
"INHERIT OPTION FOR",
|
||||
"SET OPTION FOR");
|
||||
else if (TailMatches("REVOKE", "GRANT", "OPTION", "FOR"))
|
||||
COMPLETE_WITH(Privilege_options_of_grant_and_revoke);
|
||||
else if (TailMatches("REVOKE", "ADMIN|INHERIT", "OPTION", "FOR"))
|
||||
else if (TailMatches("REVOKE", "ADMIN|INHERIT|SET", "OPTION", "FOR"))
|
||||
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
|
||||
}
|
||||
|
||||
@ -3803,7 +3804,9 @@ psql_completion(const char *text, int start, int end)
|
||||
TailMatches("REVOKE", "GRANT", "OPTION", "FOR", "ALTER"))
|
||||
COMPLETE_WITH("SYSTEM");
|
||||
|
||||
else if (TailMatches("GRANT|REVOKE", "SET") ||
|
||||
else if (TailMatches("REVOKE", "SET"))
|
||||
COMPLETE_WITH("ON PARAMETER", "OPTION FOR");
|
||||
else if (TailMatches("GRANT", "SET") ||
|
||||
TailMatches("REVOKE", "GRANT", "OPTION", "FOR", "SET") ||
|
||||
TailMatches("GRANT|REVOKE", "ALTER", "SYSTEM") ||
|
||||
TailMatches("REVOKE", "GRANT", "OPTION", "FOR", "ALTER", "SYSTEM"))
|
||||
@ -3942,14 +3945,16 @@ psql_completion(const char *text, int start, int end)
|
||||
else if (HeadMatches("GRANT") && TailMatches("TO", MatchAny))
|
||||
COMPLETE_WITH("WITH ADMIN",
|
||||
"WITH INHERIT",
|
||||
"WITH SET",
|
||||
"WITH GRANT OPTION",
|
||||
"GRANTED BY");
|
||||
else if (HeadMatches("GRANT") && TailMatches("TO", MatchAny, "WITH"))
|
||||
COMPLETE_WITH("ADMIN",
|
||||
"INHERIT",
|
||||
"SET",
|
||||
"GRANT OPTION");
|
||||
else if (HeadMatches("GRANT") &&
|
||||
(TailMatches("TO", MatchAny, "WITH", "ADMIN|INHERIT")))
|
||||
(TailMatches("TO", MatchAny, "WITH", "ADMIN|INHERIT|SET")))
|
||||
COMPLETE_WITH("OPTION", "TRUE", "FALSE");
|
||||
else if (HeadMatches("GRANT") && TailMatches("TO", MatchAny, "WITH", MatchAny, "OPTION"))
|
||||
COMPLETE_WITH("GRANTED BY");
|
||||
|
Loading…
Reference in New Issue
Block a user