1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-24 00:23:06 +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:
Neil Conway
2007-07-03 01:30:37 +00:00
parent a1587e41ae
commit a55898131e
12 changed files with 184 additions and 26 deletions

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.596 2007/06/23 22:12:51 tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.597 2007/07/03 01:30:36 neilc Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -4546,6 +4546,24 @@ RenameStmt: ALTER AGGREGATE func_name aggr_args RENAME TO name
n->newname = $6;
$$ = (Node *)n;
}
| ALTER SEQUENCE relation_expr RENAME TO name
{
RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_SEQUENCE;
n->relation = $3;
n->subname = NULL;
n->newname = $6;
$$ = (Node *)n;
}
| ALTER VIEW relation_expr RENAME TO name
{
RenameStmt *n = makeNode(RenameStmt);
n->renameType = OBJECT_VIEW;
n->relation = $3;
n->subname = NULL;
n->newname = $6;
$$ = (Node *)n;
}
| ALTER INDEX relation_expr RENAME TO name
{
RenameStmt *n = makeNode(RenameStmt);