mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Fix incorrect tab-completion for GRANT and REVOKE
Previously "GRANT * ON * TO " was tab-completed to add an extra "TO",
rather than with a list of roles. This is the bug that commit 2f88807
introduced unexpectedly. This commit fixes that incorrect tab-completion.
Thomas Munro, reviewed by Jeff Janes.
This commit is contained in:
@ -3227,15 +3227,6 @@ psql_completion(const char *text, int start, int end)
|
|||||||
COMPLETE_WITH_CONST("FROM");
|
COMPLETE_WITH_CONST("FROM");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Complete "GRANT/REVOKE * ON * *" with TO/FROM */
|
|
||||||
else if (pg_strcasecmp(prev5_wd, "GRANT") == 0 &&
|
|
||||||
pg_strcasecmp(prev3_wd, "ON") == 0)
|
|
||||||
COMPLETE_WITH_CONST("TO");
|
|
||||||
|
|
||||||
else if (pg_strcasecmp(prev5_wd, "REVOKE") == 0 &&
|
|
||||||
pg_strcasecmp(prev3_wd, "ON") == 0)
|
|
||||||
COMPLETE_WITH_CONST("FROM");
|
|
||||||
|
|
||||||
/* Complete "GRANT/REVOKE * ON ALL * IN SCHEMA *" with TO/FROM */
|
/* Complete "GRANT/REVOKE * ON ALL * IN SCHEMA *" with TO/FROM */
|
||||||
else if ((pg_strcasecmp(prev8_wd, "GRANT") == 0 ||
|
else if ((pg_strcasecmp(prev8_wd, "GRANT") == 0 ||
|
||||||
pg_strcasecmp(prev8_wd, "REVOKE") == 0) &&
|
pg_strcasecmp(prev8_wd, "REVOKE") == 0) &&
|
||||||
@ -3295,6 +3286,15 @@ psql_completion(const char *text, int start, int end)
|
|||||||
pg_strcasecmp(prev_wd, "FROM") == 0))
|
pg_strcasecmp(prev_wd, "FROM") == 0))
|
||||||
COMPLETE_WITH_QUERY(Query_for_list_of_grant_roles);
|
COMPLETE_WITH_QUERY(Query_for_list_of_grant_roles);
|
||||||
|
|
||||||
|
/* Complete "GRANT/REVOKE * ON * *" with TO/FROM */
|
||||||
|
else if (pg_strcasecmp(prev5_wd, "GRANT") == 0 &&
|
||||||
|
pg_strcasecmp(prev3_wd, "ON") == 0)
|
||||||
|
COMPLETE_WITH_CONST("TO");
|
||||||
|
|
||||||
|
else if (pg_strcasecmp(prev5_wd, "REVOKE") == 0 &&
|
||||||
|
pg_strcasecmp(prev3_wd, "ON") == 0)
|
||||||
|
COMPLETE_WITH_CONST("FROM");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Complete "GRANT/REVOKE * TO/FROM" with username, PUBLIC,
|
* Complete "GRANT/REVOKE * TO/FROM" with username, PUBLIC,
|
||||||
* CURRENT_USER, or SESSION_USER.
|
* CURRENT_USER, or SESSION_USER.
|
||||||
|
Reference in New Issue
Block a user