1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Add more ALTER <object> .. SET SCHEMA commands.

This adds support for changing the schema of a conversion, operator,
operator class, operator family, text search configuration, text search
dictionary, text search parser, or text search template.

Dimitri Fontaine, with assorted corrections and other kibitzing.
This commit is contained in:
Robert Haas
2010-11-26 17:27:23 -05:00
parent 1d9a0abec1
commit 55109313f9
21 changed files with 620 additions and 13 deletions

View File

@ -741,10 +741,9 @@ psql_completion(char *text, int start, int end)
}
}
/* ALTER CONVERSION,SCHEMA <name> */
/* ALTER SCHEMA <name> */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
(pg_strcasecmp(prev2_wd, "CONVERSION") == 0 ||
pg_strcasecmp(prev2_wd, "SCHEMA") == 0))
pg_strcasecmp(prev2_wd, "SCHEMA") == 0)
{
static const char *const list_ALTERGEN[] =
{"OWNER TO", "RENAME TO", NULL};
@ -752,6 +751,16 @@ psql_completion(char *text, int start, int end)
COMPLETE_WITH_LIST(list_ALTERGEN);
}
/* ALTER CONVERSION <name> */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
pg_strcasecmp(prev2_wd, "CONVERSION") == 0)
{
static const char *const list_ALTERGEN[] =
{"OWNER TO", "RENAME TO", "SET SCHEMA", NULL};
COMPLETE_WITH_LIST(list_ALTERGEN);
}
/* ALTER DATABASE <name> */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
pg_strcasecmp(prev2_wd, "DATABASE") == 0)
@ -1237,15 +1246,9 @@ psql_completion(char *text, int start, int end)
pg_strcasecmp(prev3_wd, "SEARCH") == 0 &&
(pg_strcasecmp(prev2_wd, "TEMPLATE") == 0 ||
pg_strcasecmp(prev2_wd, "PARSER") == 0))
COMPLETE_WITH_CONST("RENAME TO");
else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 &&
pg_strcasecmp(prev4_wd, "TEXT") == 0 &&
pg_strcasecmp(prev3_wd, "SEARCH") == 0 &&
pg_strcasecmp(prev2_wd, "DICTIONARY") == 0)
{
static const char *const list_ALTERTEXTSEARCH2[] =
{"OWNER TO", "RENAME TO", NULL};
{"RENAME TO", "SET SCHEMA", NULL};
COMPLETE_WITH_LIST(list_ALTERTEXTSEARCH2);
}
@ -1253,14 +1256,25 @@ psql_completion(char *text, int start, int end)
else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 &&
pg_strcasecmp(prev4_wd, "TEXT") == 0 &&
pg_strcasecmp(prev3_wd, "SEARCH") == 0 &&
pg_strcasecmp(prev2_wd, "CONFIGURATION") == 0)
pg_strcasecmp(prev2_wd, "DICTIONARY") == 0)
{
static const char *const list_ALTERTEXTSEARCH3[] =
{"ADD MAPPING FOR", "ALTER MAPPING", "DROP MAPPING FOR", "OWNER TO", "RENAME TO", NULL};
{"OWNER TO", "RENAME TO", "SET SCHEMA", NULL};
COMPLETE_WITH_LIST(list_ALTERTEXTSEARCH3);
}
else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 &&
pg_strcasecmp(prev4_wd, "TEXT") == 0 &&
pg_strcasecmp(prev3_wd, "SEARCH") == 0 &&
pg_strcasecmp(prev2_wd, "CONFIGURATION") == 0)
{
static const char *const list_ALTERTEXTSEARCH4[] =
{"ADD MAPPING FOR", "ALTER MAPPING", "DROP MAPPING FOR", "OWNER TO", "RENAME TO", "SET SCHEMA", NULL};
COMPLETE_WITH_LIST(list_ALTERTEXTSEARCH4);
}
/* complete ALTER TYPE <foo> with actions */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
pg_strcasecmp(prev2_wd, "TYPE") == 0)