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.
Permissions
The role must have the DDL
permission at the database or table level.
Syntax
alter_table_rename_table_statement ::=
ALTER TABLE [schema_name.]current_name RENAME TO new_name
;
current_name ::= identifier
schema_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;