RENAME TABLE¶
RENAME TABLE
can be used to rename a table.
Warning
Renaming a table can void existing views that use this table. See more about recompiling views.
Syntax¶
ALTER TABLE [schema_name.]current_name RENAME TO new_name
schema_name ::= identifier
current_name ::= identifier
new_name ::= identifier
Parameters¶
Parameter |
Description |
---|---|
|
The schema name for the table. Defaults to |
|
The table name to apply the change to |
|
The new table name |
Examples¶
Renaming a Table¶
ALTER TABLE
public.users RENAME TO former_users;
Permissions¶
The role must have the DDL
permission at the database or table level.