diff options
author | Fujii Masao <fujii@postgresql.org> | 2015-10-01 23:39:02 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2015-10-01 23:39:02 +0900 |
commit | bf4817e4f090a0a72d1849a3d61b45e7f2feadda (patch) | |
tree | 34a6137dcf918a73c99eca9fd924a37904ce4aa6 /src | |
parent | 21995d3f6d69670b5bc5b3654970701f8abb6d9f (diff) | |
download | postgresql-bf4817e4f090a0a72d1849a3d61b45e7f2feadda.tar.gz postgresql-bf4817e4f090a0a72d1849a3d61b45e7f2feadda.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/tab-complete.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 0cb34640ede..4294ffd0520 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3227,15 +3227,6 @@ psql_completion(const char *text, int start, int end) 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 */ else if ((pg_strcasecmp(prev8_wd, "GRANT") == 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)) 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, * CURRENT_USER, or SESSION_USER. |