diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 7d222680f5..dd7d021619 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -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");