Commit 8b469bd7 authored by Robert Haas's avatar Robert Haas

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
parent 348bcd86
...@@ -1459,6 +1459,10 @@ psql_completion(const char *text, int start, int end) ...@@ -1459,6 +1459,10 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST(list_ALTERMATVIEW); 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 */ /* ALTER POLICY <name> ON */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 && else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
pg_strcasecmp(prev2_wd, "POLICY") == 0) pg_strcasecmp(prev2_wd, "POLICY") == 0)
...@@ -1467,7 +1471,10 @@ psql_completion(const char *text, int start, int end) ...@@ -1467,7 +1471,10 @@ psql_completion(const char *text, int start, int end)
else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 && else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
pg_strcasecmp(prev3_wd, "POLICY") == 0 && pg_strcasecmp(prev3_wd, "POLICY") == 0 &&
pg_strcasecmp(prev_wd, "ON") == 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 */ /* ALTER POLICY <name> ON <table> - show options */
else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 && else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 &&
pg_strcasecmp(prev4_wd, "POLICY") == 0 && pg_strcasecmp(prev4_wd, "POLICY") == 0 &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment