Add tab completion for ALTER TABLESPACE MOVE in psql.

This commit is contained in:
Fujii Masao 2014-02-01 01:45:48 +09:00
parent 5ff47acf8f
commit a87ae38be8
1 changed files with 26 additions and 4 deletions

View File

@ -1622,12 +1622,12 @@ psql_completion(char *text, int start, int end)
COMPLETE_WITH_CONST("IDENTITY");
}
/* ALTER TABLESPACE <foo> with RENAME TO, OWNER TO, SET, RESET */
/* ALTER TABLESPACE <foo> with RENAME TO, OWNER TO, SET, RESET, MOVE */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
pg_strcasecmp(prev2_wd, "TABLESPACE") == 0)
{
static const char *const list_ALTERTSPC[] =
{"RENAME TO", "OWNER TO", "SET", "RESET", NULL};
{"RENAME TO", "OWNER TO", "SET", "RESET", "MOVE", NULL};
COMPLETE_WITH_LIST(list_ALTERTSPC);
}
@ -1649,6 +1649,27 @@ psql_completion(char *text, int start, int end)
COMPLETE_WITH_LIST(list_TABLESPACEOPTIONS);
}
/* ALTER TABLESPACE <foo> MOVE ALL|TABLES|INDEXES|MATERIALIZED VIEWS */
else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
pg_strcasecmp(prev3_wd, "TABLESPACE") == 0 &&
pg_strcasecmp(prev_wd, "MOVE") == 0)
{
static const char *const list_TABLESPACEMOVETARGETS[] =
{"ALL", "TABLES", "INDEXES", "MATERIALIZED VIEWS", NULL};
COMPLETE_WITH_LIST(list_TABLESPACEMOVETARGETS);
}
else if ((pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 &&
pg_strcasecmp(prev2_wd, "MOVE") == 0) ||
(pg_strcasecmp(prev5_wd, "TABLESPACE") == 0 &&
pg_strcasecmp(prev3_wd, "MOVE") == 0 &&
pg_strcasecmp(prev2_wd, "MATERIALIZED") == 0))
{
static const char *const list_TABLESPACEMOVEOPTIONS[] =
{"OWNED BY", "TO", NULL};
COMPLETE_WITH_LIST(list_TABLESPACEMOVEOPTIONS);
}
/* ALTER TEXT SEARCH */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
@ -2559,8 +2580,9 @@ psql_completion(char *text, int start, int end)
* but we may as well tab-complete both: perhaps some users prefer one
* variant or the other.
*/
else if (pg_strcasecmp(prev3_wd, "FETCH") == 0 ||
pg_strcasecmp(prev3_wd, "MOVE") == 0)
else if ((pg_strcasecmp(prev3_wd, "FETCH") == 0 ||
pg_strcasecmp(prev3_wd, "MOVE") == 0) &&
pg_strcasecmp(prev_wd, "TO") != 0)
{
static const char *const list_FROMIN[] =
{"FROM", "IN", NULL};