diff options
author | Robert Haas <rhaas@postgresql.org> | 2015-12-10 12:28:46 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2015-12-10 12:34:56 -0500 |
commit | dcf5d7fb14b3ec59b436ce27d843574b6407e5b4 (patch) | |
tree | ae2543415745ab2987657a9af58d3079e045a7de /src | |
parent | b994acf705bea9840880b1860dca9ceb0f4785ee (diff) | |
download | postgresql-dcf5d7fb14b3ec59b436ce27d843574b6407e5b4.tar.gz postgresql-dcf5d7fb14b3ec59b436ce27d843574b6407e5b4.zip |
Improve ALTER POLICY tab completion.
Complete "ALTER POLICY" with a policy name, as we do for DROP POLICY.
And, complete "ALTER POLICY polname ON" with a table name that has such
a policy, as we do for DROP POLICY, rather than with any table name
at all.
Masahiko Sawada
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/tab-complete.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 77af953003b..303e23fa06d 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -1426,6 +1426,10 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH_LIST(list_ALTERMATVIEW); } + /* ALTER POLICY <name> */ + else if (pg_strcasecmp(prev2_wd, "ALTER") == 0 && + pg_strcasecmp(prev_wd, "POLICY") == 0) + COMPLETE_WITH_QUERY(Query_for_list_of_policies); /* ALTER POLICY <name> ON */ else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 && pg_strcasecmp(prev2_wd, "POLICY") == 0) @@ -1434,7 +1438,10 @@ psql_completion(const char *text, int start, int end) else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 && pg_strcasecmp(prev3_wd, "POLICY") == 0 && pg_strcasecmp(prev_wd, "ON") == 0) - COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL); + { + completion_info_charp = prev2_wd; + COMPLETE_WITH_QUERY(Query_for_list_of_tables_for_policy); + } /* ALTER POLICY <name> ON <table> - show options */ else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 && pg_strcasecmp(prev4_wd, "POLICY") == 0 && |