RENAME is implemented in most databases through the ALTER statement, allowing you to change an object's identifier while preserving its data, constraints, permissions, and dependent objects. In PostgreSQL and many other systems the feature is exposed as ALTER TABLE ... RENAME, ALTER INDEX ... RENAME, and similar clauses. Some engines (MySQL) also offer a dedicated RENAME TABLE command, while SQL Server exposes the functionality through the stored procedure sp_rename. Renaming is metadata-only and completes instantly because no data pages are rewritten. However, objects that reference the old name (views, stored procedures, application code) are not updated automatically, so you must refactor them manually. In transactional databases the rename is atomic and can be rolled back inside a transaction block. Not every object type is renameable in every engine, and there can be restrictions (for example SQLite cannot rename a column before version 3.25).
old_table_name
(identifier) - Current name of the tablenew_table_name
(identifier) - Desired new table nameold_column
(identifier) - Current column namenew_column
(identifier) - Desired new column nameold_index_name
(identifier) - Current index namenew_index_name
(identifier) - Desired new index nameALTER TABLE, ALTER INDEX, DROP TABLE, CREATE TABLE, TRUNCATE
PostgreSQL 7.3 (2002)
Use ALTER TABLE table_name RENAME COLUMN old_column TO new_column; in PostgreSQL, MySQL 8+, and SQLite 3.25+. In SQL Server call sp_rename 'table.old_column', 'new_column', 'COLUMN'.
The command changes only metadata. A short catalog lock is taken, but data is not rewritten. The statement completes almost instantly unless blocked by other DDL.
In databases with transactional DDL (PostgreSQL, Oracle, SQL Server) you can wrap the rename in BEGIN ... ROLLBACK or COMMIT. Rolling back restores the original name.
ALTER TABLE ... RENAME TO is defined in modern SQL standards, but vendor implementations vary. MySQL provides RENAME TABLE, while SQL Server offers sp_rename.