The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.
Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!
Renaming a View
![[Deleted User]](https://us.v-cdn.net/6029397/uploads/defaultavatar/nD0LWW9MQTB29.jpg)
You are probably aware that you can rename a table using the ALTER TABLE … RENAME command.
Example:
dbadmin=> \dt test List of tables Schema | Name | Kind | Owner | Comment --------+------+-------+---------+--------- public | test | table | dbadmin | (1 row) dbadmin=> ALTER TABLE test RENAME TO test_new; ALTER TABLE
But you might not know that you can just as easily rename a database view using a very similar command!
Example:
dbadmin=> \dv test_view; List of View Fields Schema | View | Column | Type | Size --------+-----------+--------+------+------ public | test_view | c1 | int | 8 (1 row) dbadmin=> ALTER VIEW test_view RENAME TO test_view_new; ALTER VIEW
Have fun!
0
Comments
can we rename database?
Not easily! That is, there is not a simple SQL DDL command to rename a database...
But there is a way to rename a database. You'll need to open a support ticket for that. Most of the time it's just easier to create a new database and re-load it.