mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
DDL support for collations
- collowner field - CREATE COLLATION - ALTER COLLATION - DROP COLLATION - COMMENT ON COLLATION - integration with extensions - pg_dump support for the above - dependency management - psql tab completion - psql \dO command
This commit is contained in:
@ -606,6 +606,7 @@ static const pgsql_thing_t words_after_create[] = {
|
||||
{"AGGREGATE", NULL, &Query_for_list_of_aggregates},
|
||||
{"CAST", NULL, NULL}, /* Casts have complex structures for names, so
|
||||
* skip it */
|
||||
{"COLLATION", "SELECT pg_catalog.quote_ident(collname) FROM pg_catalog.pg_collation WHERE collencoding = pg_char_to_encoding(getdatabaseencoding()) AND substring(pg_catalog.quote_ident(collname),1,%d)='%s'"},
|
||||
|
||||
/*
|
||||
* CREATE CONSTRAINT TRIGGER is not supported here because it is designed
|
||||
@ -797,7 +798,7 @@ psql_completion(char *text, int start, int end)
|
||||
pg_strcasecmp(prev3_wd, "TABLE") != 0)
|
||||
{
|
||||
static const char *const list_ALTER[] =
|
||||
{"AGGREGATE", "CONVERSION", "DATABASE", "DEFAULT PRIVILEGES", "DOMAIN",
|
||||
{"AGGREGATE", "COLLATION", "CONVERSION", "DATABASE", "DEFAULT PRIVILEGES", "DOMAIN",
|
||||
"EXTENSION", "FOREIGN DATA WRAPPER", "FOREIGN TABLE", "FUNCTION",
|
||||
"GROUP", "INDEX", "LANGUAGE", "LARGE OBJECT", "OPERATOR",
|
||||
"ROLE", "SCHEMA", "SERVER", "SEQUENCE", "TABLE",
|
||||
@ -843,6 +844,16 @@ psql_completion(char *text, int start, int end)
|
||||
COMPLETE_WITH_LIST(list_ALTERGEN);
|
||||
}
|
||||
|
||||
/* ALTER COLLATION <name> */
|
||||
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
|
||||
pg_strcasecmp(prev2_wd, "COLLATION") == 0)
|
||||
{
|
||||
static const char *const list_ALTERGEN[] =
|
||||
{"OWNER TO", "RENAME TO", "SET SCHEMA", NULL};
|
||||
|
||||
COMPLETE_WITH_LIST(list_ALTERGEN);
|
||||
}
|
||||
|
||||
/* ALTER CONVERSION <name> */
|
||||
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
|
||||
pg_strcasecmp(prev2_wd, "CONVERSION") == 0)
|
||||
@ -1521,7 +1532,7 @@ psql_completion(char *text, int start, int end)
|
||||
pg_strcasecmp(prev_wd, "ON") == 0)
|
||||
{
|
||||
static const char *const list_COMMENT[] =
|
||||
{"CAST", "CONVERSION", "DATABASE", "FOREIGN TABLE", "INDEX", "LANGUAGE", "RULE", "SCHEMA",
|
||||
{"CAST", "COLLATION", "CONVERSION", "DATABASE", "FOREIGN TABLE", "INDEX", "LANGUAGE", "RULE", "SCHEMA",
|
||||
"SEQUENCE", "TABLE", "TYPE", "VIEW", "COLUMN", "AGGREGATE", "FUNCTION",
|
||||
"OPERATOR", "TRIGGER", "CONSTRAINT", "DOMAIN", "LARGE OBJECT",
|
||||
"TABLESPACE", "TEXT SEARCH", "ROLE", NULL};
|
||||
@ -1965,7 +1976,8 @@ psql_completion(char *text, int start, int end)
|
||||
|
||||
/* DROP object with CASCADE / RESTRICT */
|
||||
else if ((pg_strcasecmp(prev3_wd, "DROP") == 0 &&
|
||||
(pg_strcasecmp(prev2_wd, "CONVERSION") == 0 ||
|
||||
(pg_strcasecmp(prev2_wd, "COLLATION") == 0 ||
|
||||
pg_strcasecmp(prev2_wd, "CONVERSION") == 0 ||
|
||||
pg_strcasecmp(prev2_wd, "DOMAIN") == 0 ||
|
||||
pg_strcasecmp(prev2_wd, "EXTENSION") == 0 ||
|
||||
pg_strcasecmp(prev2_wd, "FUNCTION") == 0 ||
|
||||
|
Reference in New Issue
Block a user