From 158e3bc8e2507244b0d1e87ee334f39b7400098a Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Tue, 4 Aug 2015 12:29:20 -0400 Subject: [PATCH] Tab completion for CREATE SEQUENCE. Vik Fearing, reviewed by Brendan Jurd, Michael Paquier, and myself --- src/bin/psql/tab-complete.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index ece0515549..62cb721cc2 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -2467,6 +2467,35 @@ psql_completion(const char *text, int start, int end) pg_strcasecmp(prev_wd, "TO") == 0) COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL); +/* CREATE TEMP/TEMPORARY SEQUENCE */ + else if ((pg_strcasecmp(prev3_wd, "CREATE") == 0 && + pg_strcasecmp(prev2_wd, "SEQUENCE") == 0) || + (pg_strcasecmp(prev4_wd, "CREATE") == 0 && + (pg_strcasecmp(prev3_wd, "TEMP") == 0 || + pg_strcasecmp(prev3_wd, "TEMPORARY") == 0) && + pg_strcasecmp(prev2_wd, "SEQUENCE") == 0)) + { + static const char *const list_CREATESEQUENCE[] = + {"INCREMENT BY", "MINVALUE", "MAXVALUE", "NO", "CACHE", + "CYCLE", "OWNED BY", "START WITH", NULL}; + + COMPLETE_WITH_LIST(list_CREATESEQUENCE); + } +/* CREATE TEMP/TEMPORARY SEQUENCE NO */ + else if (((pg_strcasecmp(prev4_wd, "CREATE") == 0 && + pg_strcasecmp(prev3_wd, "SEQUENCE") == 0) || + (pg_strcasecmp(prev5_wd, "CREATE") == 0 && + (pg_strcasecmp(prev4_wd, "TEMP") == 0 || + pg_strcasecmp(prev4_wd, "TEMPORARY") == 0) && + pg_strcasecmp(prev3_wd, "SEQUENCE") == 0)) && + pg_strcasecmp(prev_wd, "NO") == 0) + { + static const char *const list_CREATESEQUENCE2[] = + {"MINVALUE", "MAXVALUE", "CYCLE", NULL}; + + COMPLETE_WITH_LIST(list_CREATESEQUENCE2); + } + /* CREATE SERVER */ else if (pg_strcasecmp(prev3_wd, "CREATE") == 0 && pg_strcasecmp(prev2_wd, "SERVER") == 0) -- 2.40.0