Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit de1e298

Browse files
committed
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
1 parent 1e1f70c commit de1e298

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/bin/psql/tab-complete.in.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3981,11 +3981,26 @@ match_previous_words(int pattern_id,
39813981
/* CREATE MATERIALIZED VIEW */
39823982
else if (Matches("CREATE", "MATERIALIZED"))
39833983
COMPLETE_WITH("VIEW");
3984-
/* Complete CREATE MATERIALIZED VIEW <name> with AS */
3984+
/* Complete CREATE MATERIALIZED VIEW <name> with AS or USING */
39853985
else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny))
3986+
COMPLETE_WITH("AS", "USING");
3987+
3988+
/*
3989+
* Complete CREATE MATERIALIZED VIEW <name> USING with list of access
3990+
* methods
3991+
*/
3992+
else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "USING"))
3993+
COMPLETE_WITH_QUERY(Query_for_list_of_table_access_methods);
3994+
/* Complete CREATE MATERIALIZED VIEW <name> USING <access method> with AS */
3995+
else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "USING", MatchAny))
39863996
COMPLETE_WITH("AS");
3987-
/* Complete "CREATE MATERIALIZED VIEW <sth> AS with "SELECT" */
3988-
else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "AS"))
3997+
3998+
/*
3999+
* Complete CREATE MATERIALIZED VIEW <name> [USING <access method> ] AS
4000+
* with "SELECT"
4001+
*/
4002+
else if (Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "AS") ||
4003+
Matches("CREATE", "MATERIALIZED", "VIEW", MatchAny, "USING", MatchAny, "AS"))
39894004
COMPLETE_WITH("SELECT");
39904005

39914006
/* CREATE EVENT TRIGGER */

0 commit comments

Comments
 (0)