diff options
author | Tomas Vondra | 2024-12-16 15:46:56 +0000 |
---|---|---|
committer | Tomas Vondra | 2024-12-16 16:30:32 +0000 |
commit | de1e29885730851787b467449f525ff6fc7d69fa (patch) | |
tree | 19871596751d623f565a3679bb617151fbc90e58 | |
parent | 1e1f70c34a8e8cef8d7f55ecb73ef22771c2e21b (diff) |
psql: Tab completion for CREATE MATERIALIZED VIEW ... USING
The tab completion didn't offer USING for CREATE MATERIALIZED VIEW, so
add it, and offer a list of access methods, followed by SELECT.
Author: Kirill Reshke
Reviewed-By: Karina Litskevich
Discussion: https://postgr.es/m/CALdSSPhVELkvutquqrDB=Ujfq_Pjz=6jn-kzh+291KPNViLTfw@mail.gmail.com
-rw-r--r-- | src/bin/psql/tab-complete.in.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index d1cd7c54f6..9e23272fc0 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -3981,11 +3981,26 @@ match_previous_words(int pattern_id, /* CREATE MATERIALIZED VIEW */ else if (Matches("CREATE", "MATERIALIZED")) COMPLETE_WITH("VIEW"); - /* Complete CREATE MATERIALIZED VIEW <name> with AS */ + /* Complete CREATE MATERIALIZED VIEW <name> with AS or USING */ else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny)) + COMPLETE_WITH("AS", "USING"); + + /* + * Complete CREATE MATERIALIZED VIEW <name> USING with list of access + * methods + */ + else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "USING")) + COMPLETE_WITH_QUERY(Query_for_list_of_table_access_methods); + /* Complete CREATE MATERIALIZED VIEW <name> USING <access method> with AS */ + else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "USING", MatchAny)) COMPLETE_WITH("AS"); - /* Complete "CREATE MATERIALIZED VIEW <sth> AS with "SELECT" */ - else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "AS")) + + /* + * Complete CREATE MATERIALIZED VIEW <name> [USING <access method> ] AS + * with "SELECT" + */ + else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "AS") || + Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "USING", MatchAny, "AS")) COMPLETE_WITH("SELECT"); /* CREATE EVENT TRIGGER */ |