mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Add ALTER VIEW ... RENAME TO, and a RENAME TO clause to ALTER SEQUENCE.
Sequences and views could previously be renamed using ALTER TABLE, but this was a repeated source of confusion for users. Update the docs, and psql tab completion. Patch from David Fetter; various minor fixes by myself.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.165 2007/06/13 23:59:47 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.166 2007/07/03 01:30:37 neilc Exp $
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
@@ -602,7 +602,7 @@ psql_completion(char *text, int start, int end)
|
||||
static const char *const list_ALTER[] =
|
||||
{"AGGREGATE", "CONVERSION", "DATABASE", "DOMAIN", "FUNCTION",
|
||||
"GROUP", "INDEX", "LANGUAGE", "OPERATOR", "ROLE", "SCHEMA", "SEQUENCE", "TABLE",
|
||||
"TABLESPACE", "TRIGGER", "TYPE", "USER", NULL};
|
||||
"TABLESPACE", "TRIGGER", "TYPE", "USER", "VIEW", NULL};
|
||||
|
||||
COMPLETE_WITH_LIST(list_ALTER);
|
||||
}
|
||||
@@ -714,7 +714,7 @@ psql_completion(char *text, int start, int end)
|
||||
{
|
||||
static const char *const list_ALTERSEQUENCE[] =
|
||||
{"INCREMENT", "MINVALUE", "MAXVALUE", "RESTART", "NO", "CACHE", "CYCLE",
|
||||
"SET SCHEMA", NULL};
|
||||
"SET SCHEMA", "RENAME TO", NULL};
|
||||
|
||||
COMPLETE_WITH_LIST(list_ALTERSEQUENCE);
|
||||
}
|
||||
@@ -728,6 +728,14 @@ psql_completion(char *text, int start, int end)
|
||||
|
||||
COMPLETE_WITH_LIST(list_ALTERSEQUENCE2);
|
||||
}
|
||||
/* ALTER VIEW <name> */
|
||||
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
|
||||
pg_strcasecmp(prev2_wd, "VIEW") == 0)
|
||||
{
|
||||
static const char *const list_ALTERVIEW[] = {"RENAME TO", NULL};
|
||||
|
||||
COMPLETE_WITH_LIST(list_ALTERVIEW);
|
||||
}
|
||||
/* ALTER TRIGGER <name>, add ON */
|
||||
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
|
||||
pg_strcasecmp(prev2_wd, "TRIGGER") == 0)
|
||||
|
Reference in New Issue
Block a user